473,840 Members | 1,623 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET MVC Routes

Hi,

I was checking the new ASP.NET MVC Preview 4 features and I found the
following:

var dataTokens = new RouteValueDicti onary();
dataTokens.Add( "namespaces ", new HashSet<string> (
new string[] {
"MyApp.Blog.Con trollers",
"MyApp.Forum.Co ntrollers",
"MyApp.Controll ers"
}));

routes.Add(
new Route("ns/{controller}/{action}/{id}", new MvcRouteHandler ()) {
Defaults = new RouteValueDicti onary(new {
action = "Index",
id = (string)null
}),
DataTokens = dataTokens
});

Does this it mean that I can differentiate two distinct parts of my
application such as the web site itself and the CMS.

For example I could have:

Site/Home/Contacts

and

CMS/Documents/List

And can I have the view in two different folders?

For example:

-Views
-----Site
---------Contacts
---------Document
--------------List
-----CMS
---------Document
--------------List
--------------New
-----Shared

As you can see Document List View is different in the web site and in
the CMS.
Can I organize my views in such a way?

Thanks,
Miguel
Jul 29 '08 #1
1 1969
I am not sure I am understanding what you are attempting, so I will go
through routes and try to see if I can cover your requirements.

Routing does give you the ability to organize your views and controllers how
you would like. If you cannot do it by routing alone, there are ways you can
alter the code to get precisely what you desire. There is quite a bit that
you can override in the framework.

Yes, you can set up different sections differently. And routing is certainly
one way. But altering the way views are stored is not entirely necessary to
have the URL string vary. The physical organization (where the aspx files
are stored, if you are using aspx for your views) need not match the logical
organization (route).

I suggest you examine how different people have organized their sites. Rob
Connery's sample application (http://www.codeplex.com/mvcsamples) has a lot
in it that can help you get a grasp of how some of these features can work
in your application. There is also Kigg (http://www.codeplex.com/Kigg/), a
Digg clone in MVC.

Another way to learn is the videos on asp.net:
http://www.asp.net/learn/3.5-SP1/default.aspx has the storefront at the
bottom (mvcsamples).
there are also a variety of vids by Hanselman at http://www.asp.net/mvc/

Now that routing is in .NET 3.5 SP1, and decoupled from MVC, you can find
all sorts of blog entries on it:
http://blogs.msdn.com/mikeormond/arc...orization.aspx
http://chriscavanagh.wordpress.com/2...url-rewriting/

And there is a route tester Haack wrote
http://haacked.com/archive/2008/03/1...-debugger.aspx

If you write your routing correctly, you can even mix legacy applications
with MVC, which means you do not have to rewrite everything at once.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************** *************** **************
| Think outside the box! |
*************** *************** **************
"shapper" <md*****@gmail. comwrote in message
news:d6******** *************** ***********@i76 g2000hsf.google groups.com...
Hi,

I was checking the new ASP.NET MVC Preview 4 features and I found the
following:

var dataTokens = new RouteValueDicti onary();
dataTokens.Add( "namespaces ", new HashSet<string> (
new string[] {
"MyApp.Blog.Con trollers",
"MyApp.Forum.Co ntrollers",
"MyApp.Controll ers"
}));

routes.Add(
new Route("ns/{controller}/{action}/{id}", new MvcRouteHandler ()) {
Defaults = new RouteValueDicti onary(new {
action = "Index",
id = (string)null
}),
DataTokens = dataTokens
});

Does this it mean that I can differentiate two distinct parts of my
application such as the web site itself and the CMS.

For example I could have:

Site/Home/Contacts

and

CMS/Documents/List

And can I have the view in two different folders?

For example:

-Views
-----Site
---------Contacts
---------Document
--------------List
-----CMS
---------Document
--------------List
--------------New
-----Shared

As you can see Document List View is different in the web site and in
the CMS.
Can I organize my views in such a way?

Thanks,
Miguel
Jul 29 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
5770
by: Daniele | last post by:
Hi there is a way to put in a struct of vectors all the possibles routes in a graph from s to d? Hi thought Dijkstra but I don't know how can i do. Thanks Dax
2
1707
by: Andreas Håkansson | last post by:
Seeing how my previous post seem to have fallen between the cracks, I thought I would have a second, more direct, go at it. So my question is "Is it possible to group (Muenchian method) over multiple nodes?" I will use an example to try to explain what I need to do and what I have for data. The example might not be very realistic but it's much easier than to try and explain using the scenario I have =P Suppose I had a list of...
0
990
by: Gary Townsend | last post by:
I am hoping someone can poit me in a right direction for how is should look at implementing this with efficiency I have a form which has a combo box with a list of Schools this is the top level of the relationship There is a second combobox which lists the School Bus Routes related to the above school Finally there is a datagrid which lists the bus stops for the selected
7
6865
by: dkultasev | last post by:
Hello, could anyone help with euler circuit ? I tried to find it, found some, but they are not working. Tried to write my own one, but it supposed to be slow with big graphs because it trying all possibles situations. Prefer to get something on c++ or java, but other languages are welcome also. Tnanks
4
4722
by: mitymouse | last post by:
I am fairly familiar with scripting dos commands and that's about it. I remember some syntax and whatnot from a few programming classes I've taken but I don't remember any of the modules or functions for VB at all. Goal: I need to set persistent routes for 2 ip address on a VPN that has a dynamic gateway each time it connects. I am almost positive I can't script this with standard dos commands so I am wondering if VB will let me do this...
0
1154
by: Harch84 | last post by:
Hi guys need some serious help I have a PostgreSQL database full of bus routes and bus stops. I am drawing them out using perl and manipulating the data. What I need to be able to do is to compare the variables from one query to the variables in another. Allow me to explain further. Firstly all unique routes are selected within a specific distance of my origin point. $originsql = qq{SELECT a.stop_reference, b.service_id,...
9
3039
by: phopman | last post by:
Hello! I am currently working on a project. And have been assigned to get up to speed quickly on php. And even though I love the language, it's not easy to get up to speed in like 2 seconds :-) The code I will list below is supposed to have four parts: 1. Not logged in. List up all text from the database. 2. Logged in. List up all text from the database. But now with an "edit" button, with the possibility to jump to number 3. 3. Logged...
2
2506
by: eduardoamfm | last post by:
Hi everybody! I have the following files: (MSC.080806.00, MSC.080806.01, MSC.080806.02...) each one has the same pattern, with two different START and STOP times and values: ... START:2008/08/06 08:30:00 WED; STOP: 2008/08/06 09:00:00 WED; ... TRK KEY (COMMON_LANGUAGE_NAME) INFO (OM2TRKINFO)
5
3552
bilibytes
by: bilibytes | last post by:
Hello, I have a "big, huge" question regarding zend framework routes so lets say i have a url like this: site.com/module/controller/action there is no problem i get redirected to the controllers action in a certain module. now say i have a url like this:
0
9863
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9702
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10607
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7845
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7023
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5686
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3139
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.