Asp.net MVC3 global route and hardcoded routes?

The Default route is firing because of the {*url}. So any page that's not /Pages, will go to the default route.

Up vote 1 down vote favorite share g+ share fb share tw.

I have an application that I am using a global route to query for the current path and return page specific data. I have the routes setup like this... routes. IgnoreRoute("{resource}.

Axd/{*pathInfo}"); routes. MapRoute( "Pages", "Pages", new { controller = "Pages", action = "Index" }); routes. MapRoute( "Navigation", "Navigation", new {controller = "Navigation", action = "Index"}); routes.

MapRoute( "Default", // Route name "{*url}", // URL with parameters {controller}/{action}/{id} new { controller = "Home", action = "Index", id = UrlParameter. Optional } // Parameter defaults ); The problem I am facing is when I go to /Pages to try and add new pages, the PageController fires like it is supposed to, but when debugging, after going to /Pages the app then makes a request for the HomeController. Am I missing something in my routing setup?

Asp.net asp. Net-mvc-3 routing link|improve this question asked Sep 25 '11 at 23:41jcreamer8981,080210 97% accept rate.

The Default route is firing because of the {*url}. So any page that's not /Pages, will go to the default route. I need more info, but if you're trying to do /Pages/whatever, then you need to add an optional parameter on your Pages route: routes.

MapRoute( "Pages", "Pages/{page}", new { controller = "Pages", action = "Index", page = UrlParameter. Optional }).

Your default route is incorrect. It should look like the default route as defined when you open a new MVC 3 project, like so: routes. MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.

Optional } // Parameter defaults ); The problem is that the default route you defined will not parse any requests which reach it.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions