开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜