If a website with url "www.site.com", redirects to HomeController's Index action.
I have
www.site.com/area/controller/action/{nick}
I want the url
www.site.com/{nick}
do the same thing
How I do to create a route and where do I have to create it?
In the RouteConfig.cs or in the AreaRegistration.cs?
In your RouteConfig.cs, add following route after all routes.
routes.MapRoute
(
name: "Nick Route",
url: "{nick}",
defaults: new { area = "AreaName",
controller = "controllerName",
action = "Actionname",
nick = UrlParameter.Optional });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With