- Tue Sep 18, 2018 3:36 pm
#31976
Hello,
I’m trying to add 2 areas to my project, i would like to properly redirect users on login.
Each user have a specific role, depending on his role he will be redirected to the good area.
What is your advice to handle this properly ?
I’m modifying AccountController and HomeController with a GetAppHomeUrl method which use a User.IsInRole verification.
My problem is with the NormalizeReturnUrl function and the UserManager.UserIsInRole verification which is not working.
The IsInRole always return false for my users, but return true for the default admin user.
My users are created in the SeedHelper and roles are set with the context :
_context.UserRoles.Add(new UserRole(_tenantId, user.Id, role.Id));
When i create the users in SeedHelper, should i use UserManager.AddToRoleAsync to make IsInRoleAsync work ?
If yes, should i inject UserManager in the SeedHelper ?
Thanks
PS : Multytenancy disabled.
I’m trying to add 2 areas to my project, i would like to properly redirect users on login.
Each user have a specific role, depending on his role he will be redirected to the good area.
What is your advice to handle this properly ?
I’m modifying AccountController and HomeController with a GetAppHomeUrl method which use a User.IsInRole verification.
My problem is with the NormalizeReturnUrl function and the UserManager.UserIsInRole verification which is not working.
The IsInRole always return false for my users, but return true for the default admin user.
My users are created in the SeedHelper and roles are set with the context :
_context.UserRoles.Add(new UserRole(_tenantId, user.Id, role.Id));
When i create the users in SeedHelper, should i use UserManager.AddToRoleAsync to make IsInRoleAsync work ?
If yes, should i inject UserManager in the SeedHelper ?
Thanks
PS : Multytenancy disabled.