views:

277

answers:

2

Hi,

Scenario is like this:

I have currently logged in user. This user would like to remove his own account. He clicks button, then Membership.DeleteUser function runs. After this he is still logged in into service despite that his account was successfully deleted.

How can I force to log out him after his account was deleted?

+3  A: 
FormsAuthentication.Signout();
FormsAuthentication.RedirectToLoginPage();

Above two line should do the trick

Kusek
A: 

Above answer is correct.

FormsAuthentication.Signout();

But there is also another way to do it:

You can create link to logout site:

<a href="_layouts/signout.aspx">log out</a>

:)

truthseeker
Your question is how to Force logout an User, clicking on the sign out is something user has to do by himself, please rephrase the question.
Kusek
If the above answer is correct then mark it as so!
Ryan
I've just added alternate way. So wtf? GFY guys!
truthseeker
The point is a) Kusek's answer better fits your question (the link doesn't work in the context you describe) and b) its a bit low taking his answer (.Signout), repeating it as your own answer and then marking it as correct. Don't abuse the goodwill of posters.
Ryan
@truthseeker: You should reward good answers, not copy them.
Jonathan Sampson
I didn't copy answer because I've just add another way of doing the same, and I've rewarded Kusek voting for his answer and not for mine. So? You are just telling bullsh*ts!
truthseeker
You've accepted your own answer as correct (see green tick) despite the fact that it doesn't answer your own question and another poster had already answered your question. You should have accepted Kusek's answer. You now have 3 different people telling you the same. You sir need to grow up a little.
Ryan