4
我只想路由一個不在MVC項目中的URL。 像將一個aspx url路由到MVC控制器
http://mysite.com/Parents/default.aspx?ID=xxx
TO
http://mysite.com/accounts/login
與ID
我只想路由一個不在MVC項目中的URL。 像將一個aspx url路由到MVC控制器
http://mysite.com/Parents/default.aspx?ID=xxx
TO
http://mysite.com/accounts/login
與ID
我覺得像這樣的工作。
routes.MapRoute(
name: "Default",
url: "Parents/default.aspx?ID={id}",
defaults: new { controller = "Accounts", action = "Login", id = UrlParameter.Optional }
);
如果要重定向所有.aspx頁的 「帳戶/登錄」 重定向然後做像下面
routes.MapRoute(
"Page",
"{name}.aspx",
new { controller = "Accounts", action = "Login", id = UrlParameter.Optional }
);
routes.MapRoute( 名稱: 「默認」, 網址:「家長/default.aspx「, 默認值:new {controller =」Accounts「,action =」Login「,id = UrlParameter.Optional} 它說 - 無法找到資源/parents/default.aspx –