Session.abandon and Session.Cleear: what is the difference

J

Juan T. Llibre

Session.Clear stays in the same session.
Session.Abandon dumps the current session and starts a new session.
 
G

Guest

Session.Abandon() will end current session
Session_End will be fired and next request will fire Session_Start

Session.Clear will just clear the session data , the session is still alive

Session ID will remain same in both cases, as long as the browser is not
closed.
 
J

JJ_377

Thank you - my further question,s what is recommended in terms of
clearing any session variables in the context of:
1. on error, I want any session variables cleared and the user
redirected to a logon page
( I wish to prevent a user from reentering the error page and
recreating the original error)
3. I wish to prevent others from "backing" into web pages if a user
does not log out and session timeout has not yet occurred.

I have the web pages set so that the browser will not cache them

It kind of sounds like I just need Session.clear, but I have been using
Session.Abandon.

MY thanks!
 
Joined
May 28, 2008
Messages
11
Reaction score
0
code for proper logout

on signout button click

Session.Abondon();
Response.Cookies.Clear();
FormsAuthentication.SignOut();
Response.Redirect("../product1.aspx");

on Page_Load()

Response.Cache.SetNoStore();

this can solve back button problem
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top