How do I route the default debug path to the actual path in asp.net mvc?
When I click run on my vs2008 to try out a page it tries to load
http://localhost:14092/Views/Employee/Index.aspx
which should be
http://localhost:14092/Employee/Index
or http://localhost:14092/
How do I add these 2 routes? (I want to know how to do both so I can swap them as desir开发者_Go百科ed.
Here's my current routing code:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
}
Have you changed the debugging options to always start at a specific page? If not, go to your project's properties and change the debugging properties to have your debugger to always start the project at the root page. I typically also tell it to always use the same port -- so that I can use FF or IE and the history works to give me the right URL. See Steven Walther's article on how to run an ASP.NET MVC application for alternatives.
精彩评论