0

In my web application, there is a possibility for a user to delete a different user. But I noticed that after the user is deleted, the cookie still remains in the browser of the user, which enables them to navigate the website even though the user does not exist anymore. How do I make so that the cookie is invalid?

1 Answer 1

2

write this line of code after deleting the user:

_userManager.UpdateSecurityStamp(userId)

and it should works.

Sign up to request clarification or add additional context in comments.

7 Comments

I used it before I delete the user, nothing changes, probably since no changes have been made to the user yet. I used it after I deleted the user and it can't find the userId, since the user is deleted
are you using usermanager for deleting the user or db functions?
if you use this code for deleting the user it shouldn't be any problem: _userManager.Delete(_userManager.Users.FirstOrDefault(p => p.Id == uderId));
I'm using UserManager, exactly the way you posted here. The user is deleted, but the cookie of the user remains there. How do I use UpdateSecurityStamp(userId) with it?
look at this posts and hope it helps you: link1 link2
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.