Forced user logout in 2.0


K

kpg*

Hi all,

I want to perform the same action the the loginstatus control
does to logout a user programatically, but I can't seem to find
a 'logout' method in any of the membership classes.

The user gets authenticated using the login control and the build-in
database, but there are times when I want to logout the user and
send them back to the login page. At this point the "isAuthenticated"
method should return false.

Is there a logout method somewhere, and if not, is there a way
to perform all the steps manually to accomplish the same thing?

thanks
kpg
 
Ad

Advertisements

C

Cowboy \(Gregory A. Beamer\)

LoginControl.Logout is a possibility. If using Forms Authentication
(likely), I believe the sign out method will yield the same results. I will
have to look to see if there are other methods.
 
G

Guest

This will do what you need:

Session.Abandon();
FormsAuthentication.SignOut();
Response.Redirect("~/Default.aspx");
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top