全局asax中的MVC RedirectToRoute不在混合站点上工作

时间:2014-08-29 14:12:32

标签: asp.net-mvc-3

我最近将我们的webforms网站重建为混合mvc3 / webforms网站,其中较新的代码将替换为mvc。过去,全局asax文件的Application_Error方法中有一些代码将用户重定向到404

LifespeakExceptions.Log404();
HttpContext.Current.Server.Transfer("~/404.aspx");

然而,当我尝试用路线替换它时,它似乎无法找到它 - 例如我在registermvc3routes文件中尝试过这个

routes.MapRoute(
"404", // Route name
"pagenotfound", 
new { controller = "Utilities", action = "Error404Page" }
);

我在全球的asax中添加了这个

LifespeakExceptions.Log404();
Response.RedirectToRoute("404");

然而,它似乎无法找到这条路线,即使我知道它存在 - 直接调用它也能正常工作。这可能是因为它是一个混合网站吗?

0 个答案:

没有答案
相关问题