I can't figure it out how to configurate a routing in the startup file.
That when you redirect to a view that has another controller the URL doesn't look like:
localhost/Success/Success/Success
Where the first Success is the controller, the second Success the View folder and the third Success the name of the View itself.
I would like something like this:
localhost/Sucess/Sucess
That the name of the controller is not shown in the URL.
I'm not using a link in the navigation page but a redirect:
return Redirect("Success/Success/Success");
startup.cs:
routes.MapRoute(name: "success", template: "{controller=Success}/{action=Index}/{id?}");
Try this:
routes.MapRoute(
name: "default",
template: "{controller=Success}/{action=Index}/{id?}");
Try this - you can have multiple routes, but be aware they are order specific.
routes.MapRoute(
name: "default1",
template: "{controller=Success}/{action=Index}/{id?}");
routes.MapRoute(
name: "default2",
template: "{controller=Home}/{action=Index}/{id?}");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.