In ASP.Net, can we map multiple URLs to the same action.
Md Tahmidul Abedin
Select an image from your device to upload
You can map URL by giving two different key name and specify the same action and same controller in RegisterRoutes() Method.
routes.MapRoute( name: “myRoute”, url: “Home/{pageName}”, defaults: new { controller = “Home”, action = “Index”, pageName = UrlParameter.Optional } );
routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } );
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);