How to delete user in asp.net identity 2 -


As outlined in 1.0, if you want to delete the user, you can not do it via User Manager It is released 2.0 so we can do the following to delete a user:

  var user = Wait UserManager.FindByIdAsync (id); If (user == zero) {return HttpNotFound (); } Var results = UserManager.DeleteAsync (user) awaiting;   

But it does not work. Is there a solution for this issue?

  var um = new UserManager & lt; ApplicationUser & gt; (New userstore & lt; ApplicationUser & gt; (New ApplicationDbContext ())); Use the RemoveFromRole function (um.IsInRole (formCollection ["user"], role)) (um.RemoveFromRole (formCollection ["user"], role);} and pass (userid, rolename);  < / Pre>  

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -