Posted on: 3/6/2014 6:34:47 PM | Views : 2445

<div class="userinput"> This is a question about the new way of handling authentication and membership which is based on asp.net Identity
I have just create a web application project with web forms and make some test.
Here I have a piece of code. If I put a breakpoint at this statement userManager.AddToRole
I can see that in database table AspNetUsers I have my name tony there. If I look in table AspNetRoles I have role MyRole there.
So It would be fine to do this statement      userManager.AddToRole("tony", "MyRole");
because I have the name tony in AspNetUsers and I have MyRole in AspNetRoles
But I get exception saying "UserId not found" but name tony really exist in table AspNetUsers why do I get exception ?

 protected void Page_Load(object sender, EventArgs e)         {      ...

Go to the complete details ...