开发者

MVC route doesn't work

I have a bunch of Views in a default folder that represent single "static" pages.

开发者_开发知识库Everything works as advertised except i tried adding a new page yesterday.. using the exact same routing syntax and cannot for the life of me get it to work.

here's is an example of a working route:

routes.MapRoute(
            "OurProgram",           // Route name
            "Our_Program",          // URL with parameters
            new { controller = "Default", action = "OurProgram" }  
        );

The filename is OurProgram and hitting http:// localhost/Our_Program/ opens the correct view which resides in the Views/Default folder.

So i added another view into this folder:

Views/Default/BuyNow.aspx and added the route:

routes.MapRoute(
            "BuyNow",                  // Route name
            "Buy_Now",                 // URL with parameters
            new { controller = "Default", action = "BuyNow" }  
        );

And this doesn't open. I have tried the "route debugger http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx" and it correctly identifies the route.

I am at a lose. I have tried re-creating the view.. I am using MVC.Net 2.0 and VS 10.

Any help is appreciated!


Stab in the dark: Do you have a BuyNow action method in your controller? That's what the new route is trying to call.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜