I'm working with areas controllers as well as simple default controller. I want to make areas controller (Public) as a default route i.e public/home/home but when I go to simple controller i.e account/login it returns wrong url which is public/account/login instead of home/index.
endpoints.MapAreaControllerRoute
(
name: "default",
areaName: "Public",
pattern: "{controller=Home}/{action=Home}/{id?}"
);
endpoints.MapControllerRoute
(
name: "withOutArea",
pattern: "{controller=Home}/{action=Index}"
);
endpoints.MapControllerRoute
(
name: "area",
pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}"
);
Asp.net core will not show the full route in default route, It will just show defualt route like
https://localhost:xxxxx. If you want show the full route, you need to useurl Rewrite. I write a simple demo here:Then the default url is
https://localhost:xxxxx/Service/Home/PrivacyThe other method is add
launchUrlin yourlunchSettings.json.Fisrt you need to add
[Route("service/Home/Privacy")]in privacy action, then add"launchUrl": "https://localhost:xxxxx/service/home/privacy"inlunchSettings.json.When you run the project, The defualt url is also
https://localhost:xxxxx/Service/Home/Privacy