/ Published in: C#

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
protected void Application_PreRequestHandlerExecute(Object sender, EventArgs e) { /// only apply session cookie persistence to requests requiring session information #region session cookie { /// Ensure ASP.NET Session Cookies are accessible throughout the subdomains. if (Request.Cookies["ASP.NET_SessionId"] != null && Session != null && Session.SessionID != null) { Response.Cookies["ASP.NET_SessionId"].Value = Session.SessionID; Response.Cookies["ASP.NET_SessionId"].Domain = ".know24.net"; // the full stop prefix denotes all sub domains Response.Cookies["ASP.NET_SessionId"].Path = "/"; //default session cookie path root } } #endregion }
URL: http://www.know24.net/blog/ASPNET+Session+State+Cookies+And+Subdomains.aspx
Comments
