Author: Visual Web Developer | Posted on: 7/1/2010 4:08:00 PM | Views : 900

Hi,
(I run the below example from the hosting server)
I am setting a Session variable in a button event. So it is caught in the Page_Load event and a messageBox is displayed.
The strange thing is now if I close the browserwindow and open up a new browserwindow with this URL, this messageBox is displayed again.
 
Shouldn´t the Session variable be == null as the Session did end when the browserwindow was closed or does the Session variable exist on the server for a period of time and is tracked in this way ?
If it is, then I might wonder how the Session variable can be set to == null when the browserwindow is closing ?
protected void Page_Load(object sender, EventArgs e) { if (Session["Test"] != null) { ClientScript.RegisterStartupScript(Page.GetType(), "TestAlert", "alert('" + "Test" + "');", true); } ...

Go to the complete details ...