【发布时间】:2015-03-18 14:24:42
【问题描述】:
我尝试使用路由系统将 aspx 中的旧页面版本重定向到我的控制器中。
示例:
old Urlpage : ~/mypage.aspx?extraparam=123
new UrlPage : ~/HomeMyaction?extraparam=123 (or /Home/MyAction/123)
我试试这个:
routes.MapRoute(
name: "MyPage",
url: "mypage.aspx",
defaults: new { controller = "Home", action = "MyAction" },
namespaces: new string[] { "MyApp.Controllers" });
routes.MapRoute(
name: "MyPage",
url: "{namepage}.aspx",
defaults: new { controller = "Home", action = "MyAction" },
namespaces: new string[] { "MyApp.Controllers" });
但每次尝试我的网站都会返回错误 404,因为他尝试访问“mypage.aspx”,但它们不再存在,我无法更改旧的访问权限。
我尝试像 .axd 一样忽略“mypage.aspx”
routes.IgnoreRoute("mypage.aspx/{*pathInfo}");
但我总是 404 BadRequest 'Ressources not found'
【问题讨论】:
标签: c# model-view-controller routes