'Redirect to user on specific area after login based on there role
i am creating web application using dot net core 6.0. application contain two type of user one is admin and second is simple user area. i want that when user is login base on there role he/she redirect to there area like if user is admin he redirect to admin area. else redirect to user area. `
@if (signInManager.IsSignedIn(User))
{
if (User.IsInRole("SuperAdmin"))
{
Response.Redirect(Url.Action("Index", "AdminDashboard", new { Area = "SuperAdmin" }));
}
else if (User.IsInRole("User"))
{
Response.Redirect(Url.Action("Index", "User", new { Area = "User" }));
}
}
` i try this code in layout file but this code in not work properly
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
