使用的Default.aspx /控制器/动作风格的URL时,ASP.NET MVC路由失败 [英] ASP.NET MVC routing fails when using default.aspx/controller/action style url
问题描述
我部署一个ASP.NET MVC网站到IIS6 Web服务器,所以我使用的的Default.aspx / {控制器} / {行动} 的风格路由策略。
然而,由于某种原因,它使用Default.aspx的一部分时,不会真正发挥作用。无论URL,它总是得到默认的控制器(公众)的默认操作(指数)。
我已经用出色的路由调试器看看发生了什么事情。
如你所见,我要求的的Default.aspx /联系人的,这应该与表3号路线。
其实什么是我写后的的Default.aspx / 的最后两个路由匹配表中(我的理解是最后一个)。
我得到两个卡西尼和IIS6这一行为。
为什么会出现这种情况?
RouteTable.Routes.RouteExistingFiles = TRUE;
现在它的作品。
得到这里答案
我觉得这个信息应该已经在asp.net/mvc的网站,如的将此页例如的。
I'm deploying an ASP.NET MVC site to a IIS6 webserver, so I'm using a default.aspx/{controller}/{action} style routing strategy.
However, for some reason it doesn't really work when using the default.aspx part. No matter the url, it always gets the default action (Index) on the default controller (Public).
I've been using the excellent Routing Debugger to see what's going on.
As you can see I'm requesting default.aspx/contact, which should match the 3rd route in the table. Actually ANYTHING I write after default.aspx/ matches the two last routes in the table (I understand the last one).
I'm getting this behavior on both Cassini and IIS6.
Why is this happening?
RouteTable.Routes.RouteExistingFiles = true;
Now it works. Got the answer from here.
I think this info should have been on the asp.net/mvc site, like this page for instance.
这篇关于使用的Default.aspx /控制器/动作风格的URL时,ASP.NET MVC路由失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!