Question #1
I want to know when am I supposed to use:
Session.Abandon() // When I use this during tracing and after calling it- I find the session still has a value.
And when am I supposed to use :
When should I use each specific method?
- In general?
- In my specific case?
I check if session is not equal null in Page Load. If session is equal to null, I wanna to clear session and redirect to the login page?
Should I use something like this:
private void initSession()
{
Session.Clear();
Session.Abandon();
Response.Redirect("LoginPage.aspx");
}
In ASP.NET, when should I use Session.Clear() rather than Session.Abandon()?
What is the difference between Session.Abandon() and Session.Clear()
Session.Clear() or Session.Abandon() ?
Question
I check on some sessions if not equal null in the page load. if one of them equal null i wanna to clear all the sessions and redirect to the login page?
Answer
If you want the user to login again, use Session.Abandon.