I have a problem. My MapAreaControllerRoute is blocking MapControllerRoute. That means when I open app in browser localhost:7155
it opens login as normal https://localhost:7155/login.html?ReturnUrl=%2F
then after logging in it opens Admin area localhost:7155/Admin/Dashboard/Categories
instead of Home controller.
Here is a part of Program.cs:
app.MapAreaControllerRoute(
name: "areas",
areaName: "Admin",
pattern: "{area:exists}/{controller=Dashboard}/{action=Index}/{id?}");
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
I tried this:
While debugging I saw that route /
is a actually the admin area.
Log:
–==[CALLBACK: / ]==—
Here is a part of the code:
await Request.HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal, properties);
string? callbackUrl = Request.Query["ReturnUrl"];
if (!string.IsNullOrWhiteSpace(callbackUrl))
{
Console.WriteLine($"---==[ CALLBACK: {callbackUrl} ]==---");
return Redirect(callbackUrl);
}
Btw my controller automatically redirects to categories action
Xaus Master is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.