RoleManager or another way of getting the current user's Roles in a Razor page.
Hi All,
I am trying to port an Umbraco 8 page to 13, and one of the features currently being used in the Razor page is
System.Web.Security.Roles.GetRolesForUser
Which returns a list of Roles assigned to the member.
However this is not available under .Net Core. I understand that you can do something similar using RoleManager, however this does not appear to be available for injection into a Razor page.
The alternative appears to be IMembershipRoleService, however I cannot find any information on how to use this.
Has anyone done something similar?
The only other option would be to access the Roles from within a Render Controller, and pass them to the View.
RoleManager or another way of getting the current user's Roles in a Razor page.
Hi All,
I am trying to port an Umbraco 8 page to 13, and one of the features currently being used in the Razor page is
System.Web.Security.Roles.GetRolesForUser
Which returns a list of Roles assigned to the member.
However this is not available under .Net Core. I understand that you can do something similar using RoleManager, however this does not appear to be available for injection into a Razor page.
The alternative appears to be IMembershipRoleService, however I cannot find any information on how to use this.
Has anyone done something similar?
The only other option would be to access the Roles from within a Render Controller, and pass them to the View.
Thanks
Kap
You could just use the IMemberManager
Thanks Huw! You are a life saver! Worked perfectly.
Thanks
Kap.
is working on a reply...