redirect to different page after user login #7057
-
Hi, I would redirect user after successful login to a different page than dashboard depending on value of some user properties. Thank you, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Hi @elenaaralla, you can create a controller that has a route of For example: public class IndexController : Controller
{
[Route("~/")]
public ActionResult Index([FromServices] ...)
{
// if user is not logged in redirect to login page using "return Redirect("~/Account/Login");" (your login page might be different)
// get properties of user using ISqlConnections with IUserAccessor etc. and redirect to the according page
// if user doesn't have a dashboard etc. return the fallback index file
}
} |
Beta Was this translation helpful? Give feedback.
-
Dashboardpage.cs is in Common/Dashboard page this is my code for different Dashboard models `[Route("Dashboard/[action]")]
|
Beta Was this translation helpful? Give feedback.
-
Thank you to all! |
Beta Was this translation helpful? Give feedback.
Thank you to all!