Posted on: 2/5/2014 6:45:51 AM | Views : 768

Hi, I am trying the new AspNet Identity functionality, and I am puzzled by the following.
Using a new Visual Studio 2013, ASP.NET Web Application (webforms) with standard Identity model, just local user accounts, nothing external. Creating new users and saving them to the database through Entity Framework works no problems.
However, executing the following code attached to OnClick event of an aspx page button, I would expect the currently logged in user to receive the “Admin” claim, of the role type.
protected void btnMakeAdmin_Click(object sender, EventArgs e) { var manager = new UserManager(); if (manager.SupportsUserClaim) if (!User.IsInRole("Admin")) manager.AddClaimAsync(Context.User.Identity.GetUserId(), new Claim(ClaimTypes.Role, "Admin")); bool success = User.IsInRole("Admin"); }

Go to the complete details ...