Route aspx url for MVC

I just want to redirect a URL that is not in the MVC project. how

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

TO

 http://mysite.com/accounts/login 

with identifier

+4
source share
2 answers

I think something like this will work.

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

If you want to redirect all .aspx pages to redirect to "accounts / login", follow these steps:

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

Source: https://habr.com/ru/post/1499630/


All Articles