views:

8203

answers:

4

i redirect the user to the login page when user click log out however i don't think it clear any application or session because all the data persisted when the user log back in.

currently the login page have a login control and the code behind on the page only wired up the login Authenticate.

Can someone direct me to a good tutorial or article about handling log in and out of asp.net web site.

A: 

Session.Clear();

BobbyShaftoe
+14  A: 
Session.Abandon()

http://msdn.microsoft.com/en-us/library/ms524310.aspx

Here is a little more detail on the HttpSessionState object:

http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate_members.aspx

Ryan Cook
I try Session.Abandon but it still not clearing out the session.
Jack
Something strange is happening, because Session.Abandon() should give the user a new session. Maybe you have a different problem, if you find more/better data: post it and I'm sure the community will try to help out.
Ryan Cook
+5  A: 

I would prefer Session.Abandon()

Session.Clear will not cause End to fire and further requests from the client will not raise the Session Start event.

AnthonyWJones
A: 

u must use a javascript code to do so becoz none of session.Abandon() & session.clear() can sort out this problem so just go for javascript