Forced user logout in 2.0

  • Thread starter Thread starter kpg*
  • Start date Start date
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
 
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.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
 
This will do what you need:

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