asp.net-mvc-routing

ASP.Net MVC Keeping action parameters between postbacks

Say I have a page that display search results. I search for stackoverflow and it returns 5000 results, 10 per page. Now I find myself doing this when building links on that page: <%=Html.ActionLink("Page 1", "Search", new { query=ViewData["query"], page etc..%> <%=Html.ActionLink("Page 2", "Search", new { query=ViewData["query"], page e...

How can I create a friendly URL in ASP.NET MVC?

How do I generate friendly URLs within the ASP.NET MVC Framework? For example, we've got a URL that looks like this: http://site/catalogue/BrowseByStyleLevel/1 The 1 is Id of the study level (Higher in this case) to browse, but I'l like to reformat the URL in the same way StackOverflow does it. For example, these two URLs will take yo...

ASP.NET MVC Beta - Grouping Controllers and Views possible?

I am on the way to build an ASP.NET MVC application with the latest beta release and I wonder if it is possible to change the default project Layout of /Views/Home/Index.aspx /Views/Home/About.aspx to /Blog/Views/Home/Index.aspx /Blog/Views/Home/About.aspx /Forum/Views/Home/Index.aspx /Forum/Views/Home/About.aspx The goal is to get ...

ASP.NET MVC routes

I need help with this route map routes.MapRoute("Blog_Archive", "Blog/Archive/{year}/{month}/{day}", new { controller = "Blog", action = "archive", year = "", month = "", day = "", ...

MVC route localization

While playing around with localization using Matt Hawley's approach. I wonder if someone has figured to localize routes. I can do this using global resources per site. But when I would try to make it a users choice (so users can switch between languages) the architecture does not allow it because the routes are mapped at application star...

ASP.NET MVC Beta 1 - URI Routing Syntax

I have scoured the web for a decent explanation of the routing syntax in ASP.NET MVC Beta 1 but I still can't get it to work. Please could someone explain what I need to put in my Global.asax.cs file to have two supported URIs for my site: www.mysite.com/map.aspx (i.e the site without any explicit parameters/actions for performing the...

Build objects with variable number of members?

In my asp.net mvc page, I want to call a RedirectToAction(actionName, controllerName, values). The values parameter is an object that contains all the nessecary values. Example return RedirectToAction(redirectAction, redirectController, new{ personId = foundId, personEmail = foundEmail, personH...

MVC.Net Routing

Here is my scenario. For the example lets say that I need to return a list of cars based on a search criteria. I would like to have a single View to display the results since the output will be the same, but I need several ways of getting there. For instance, I may have a Form with a textbox to search by year. I may have another sepa...

ASP.NET MVC - MapRoute versus routes.Add (and 404s)

I'm just getting started with ASP.NET MVC. What is the difference between MapRoute and routes.Add ? Should I just be using MapRoute? Can I map multiple routes? Which "maps" take precedence... those you called first or last? I'd like to be able to do something similiar to the StackOverflow does for users. But I would like the URL to fit...

Custom ASP.NET MVC 404 Error Page

I am trying to make a custom HTTP 404 error page when someone types in a URL that doesn't invoke a valid action or controller in ASP.NET MVC Instead of it displaying the generic Resource Not Found ASP.NET error I don't want to use the web config to handle this... Is there any kind of routing magic I can do to catch any invalid urls? ...

How do I set up a universal controller in ASP.NET MVC?

I know it's not perhaps in the true spirit of MVC, but I just want to have a single global controller that always gets called no matter what the url looks like. For example, it could be: http://myserver.com/anything/at/all/here.fun?happy=yes&amp;sad=no#yippie ...and I want that to be passed to my single controller. I intend to obtain t...

ASP .NET MVC default routing problem RTW 1.0

I have just installed the RTW 1.0 of the MVC framework. I was using RC2 in the past to go through the tutorials. I now have a problem where basic routing doesn't work which i didn't have in RC2. If i create a new MVC application in VS 2008 the routings for the home page don't work out of the box. The following URL's work for some reaso...

Routing based on the request uri host

So the basic premise to this problem is that I have a single hosted webspace which came with two domain names. I am unsure how to configure routing in asp.net mvc so that the first thing I would check would be this host in the request object so that I can more user traffic to two separate parts of my website. For example: http://www.my...

ASP.NET MVC retrieving route to controller, action and parameters

In ASP.NET MVC how can I generate a URL to a specific controller and action along with other parameters. The RedirectToAction allows me to redirect, but I would like to retrieve this URL instead from within my controller. I tried using: Url.Action("Page", "Administrator", New With {.page = _currentPage}) But that returned a link like...

How to assign controller name and action name dynamically in asp.net mvc

How to assign controller name and action name dynamically in asp.net mvc ...

ControllerActionInvoker

What is the use of ControllerActionInvoker class? ...

How do you change the controller text in an ASP.NET MVC URL?

I was recently asked to modify a small asp.net mvc application such that the controler name in the urls contained dashes. For example, where I created a controller named ContactUs with a View named Index and Sent the urls would be http://example.com/ContactUs and http://example.com/ContactUs/Sent. The person who asked me to make the chan...

ASP.NET MVC Authenticated User Being Directed to Wrong Route After Login

I am building an ASP.NET MVC application using the 1.0 release using Visual Web Developer Express (temporarily). I am using the SqlMembership Provider and forms authentication to handle security for the site. My site security requires the user to login before seeing anything -- there are no anonymous user pages except for the login pag...

ASP.NET MVC Structural design problem

Hi, i'm new to ASP.NET MVC and i'm facing some structural design problems. I can't figure out how to setup routing. I want the following: http://website/ > HomeController Action=Index Public: http://website/{controller} > SectionController Action=Index http://website/products/id ...

Creating an action link in a Controller

In one of my controller actions, I'm generating some XML. One of the attributes in that XML is an href to another controller and action, with some parameters. The XML should look something like this: <projects> <project id="42" name="Project X", href="/projects/42"/> <!-- etc. --> </projects> I don't mind if the URL is relative or...