I have a project with Identity 3.0. I have setup a dynamic menu which also works and displays a different menu list depending on what role you are in.
I would like Authorized users to have different home page. If you are UnAuthorized you should see "/Home/Index" as per normal.
If you are Authorized (logged in as a user and it remembers you..) you should always be directed to a different home page for Authorized users... say "/Scheduling/Index".
I have set an AuthorizeFilter
services.AddMvc(setup =>
{
setup.Filters.Add(new AuthorizeFilter(defaultPolicy));
});
so unless you are Authorized you get sent to the login page if you are try an access any controller without the:
[AllowAnonymous]
at the start... eg HomeController has this at the start...
I found this on Stackoverflow and tried it in the StartUp class but it doesnt work.
services.Configure<CookieAuthenticationOptions>(options =>
{
options.LoginPath = new PathString("/Scheduler/Index");
});
How can I have two different home pages depending on whether the user is logged in or not logged in?