Just a small precision...
re:
i have a simple app that references the web.config.
i browse to the page.
i changed the web.config.
i do a postback to the page,
And session is gone.
True.
The Application and the Sessions will restart
if you update either web.config or global.asax.
re:
Only after i close the browser
and reopen it start working with the new settings.
No.
The new settings apply immediately after the Application restarts,
and are not dependent on the browser having been closed.
Remember that the Session changes are made server-side
and do *not* depend on whether the browser has been closed or not.
What you *will* see is that IE will continue to use the same Session ID.
For a new Session ID to be used by IE,
the browser must be closed and reopened.
IE *does not* recycle the Session ID number until the browser is closed
but *all* your Server's session variables will start afresh.
Regardless of whether you close the browser, or not,
you *do* have a fresh set of session variables to work with
if you make a change to either global.asax or web.config.
This is real easy to test for.
Run this script as Sessiontest.aspx :
-----------------------------------------------------
<%@ Page Language="VB" %>
<html>
<head>
</head>
<body>
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Response.Write("Session ID : " & Session.SessionID)
Response.Write("<br />")
Session.Contents("SessionStartTime") = Now
Response.Write("<br />")
Dim Item as String
For Each Item In Session.Contents
Response.Write (Item & " = " & Session(Item))
Response.Write ("<br>")
Next
End Sub
</script>
</body>
</html>
-----------------------------------------------------
After you run it, you will see the SessionID and the SessionStartTime
session variable.
If you now update either web.config or global.asax and refresh the page,
you will see the same Session ID, but a fresh start time.
The Session ID has been recycled, but you're in a new session.
If you then close the browser and reopen it, you will see
a new Session ID *and* a fresh start time.