I store some user info in Session["username"] on default.aspx.
Default.aspx.cs:
Session["username"] = txtUsername.Text;
Response.Redirect("page2.aspx", false);
Page2.aspx.cs:
if (HttpContext.Current.Session["username"] == null)
{
WriteLog("Session is null");
}
It works on most of the machines including Windows Server 2012, but on one server running Windows Server 2012 it doesn't work. It happens only in IE, works fine in Chrome.
Why the session becomes null when running on IE?
IIS and IE has the following settings:
IE settings to Always allow session cookies
.
In IIS, session state has these settings:
- In Process
- Cookie mode=Use Cookies
- Time-Out=20 mins
- Use Hosting Identity for Impersonation checked