簡體   English   中英

將aspx URL路由到MVC控制器

[英]Route an aspx url to MVC controller

我只想路由一個不在MVC項目中的URL。 喜歡

http://mysite.com/Parents/default.aspx?ID=xxx

http://mysite.com/accounts/login

帶有身份證

我認為這樣的事情會起作用。

routes.MapRoute(
            name: "Default",
            url: "Parents/default.aspx?ID={id}",
            defaults: new { controller = "Accounts", action = "Login", id = UrlParameter.Optional }
        );

如果要將所有.aspx頁面重定向到“accounts / login”重定向,請執行以下操作

routes.MapRoute(
   "Page",
   "{name}.aspx",
   new { controller = "Accounts", action = "Login", id = UrlParameter.Optional }
 );

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM