How to Sign Out in Asp.Net 2.0?

M

Miguel Dias Moura

Hello,

In my web site I am using Asp.Net 2.0 and "Membership.ValidateUser" to
login a user.
I didn't use the login controls. I created my own custom look login and
used membership API.

I created an image button which says logout. How to I make it logout
when it is pressed.
I tried to find a function similar to "Membership.ValidateUser" but to
logout. I wasn't able to find it.

Thanks,
Miguel
 
G

Guest

Miguel,
If it is using Forms Authentication as I suspect you are, the
FormsAuthentication class has a very handy SignOut method.

Peter
 
A

ammulu

Hi,

Log on to:http://www.vkinfotek.com

Briefly the code for SignOut

Sub SignOut(ByVal objSender As Object, ByVal objArgs As EventArgs)
'Delete the cookie and signout
FormsAuthentication.SignOut()
'Redirect the user to thieir referring page
Response.Redirect(Request.UrlReferrer.ToString())
End Sub

Regards
Bhar
 
Joined
Aug 19, 2006
Messages
4
Reaction score
0
very eassy way to signout...

Sub logOut(ByVal obj As Object, ByVal e As EventArgs)

Session.Abandon()
Session.Remove("username")
FormsAuthentication.SignOut()
Response.Redirect(Request.UrlReferrer.ToString())

End Sub

this is the simple way to logout...
here what ever u had given IN sessionid u mention place of usarname..

if any problem plz mail me..
THANKS
SAMIR JHA & SAURAV
(e-mail address removed)
INDIA
 
Last edited:

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top