There is existing code in my application that does this:
if (HttpContext.Current.User.IsInRole("Customer Account Admin"))
//
{
}
else
{
mi = radmenu1.Items.FindItemByText("Admin");
radmenu1.Items.Remove(mi);
}
What puts the user in that role We are NOT using the old Role Manager. We are using ASP.NET Identity 2.0 and this doesn't seem to do it:
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
if (manager.AddToRole(manager.FindByName(UserName.Text).Id, "Customer Account Admin").Succeeded)
{
c.logActivity("Register.aspx.cs", "REG_USER_ROLE", "Setting user to Admin role succeeded");
...
Go to the complete details ...