protected void Application_PreRequestHandlerExecute(Object sender, EventArgs e)
{
/// only apply session cookie persistence to requests requiring session information
#region session cookie
if (Context.Handler is IRequiresSessionState || Context.Handler is IReadOnlySessionState )
/// 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
/// delete all cookies
HttpCookie httpCookie;
int iCookieCount = HttpContext.Current.Request.Cookies.Count;
for (int i = 0; i < iCookieCount; i++)
httpCookie = new HttpCookie(HttpContext.Current.Request.Cookies[i].Name);
httpCookie.Expires = DateTime.Now.AddDays(-1);
httpCookie.Path = HttpContext.Current.Request.Cookies[i].Path;
httpCookie.Domain = HttpContext.Current.Request.Cookies[i].Domain;
httpCookie.Values.Clear();
HttpContext.Current.Response.Cookies.Add(httpCookie);
Remember Me
Page rendered at Sunday, May 19, 2013 7:10:04 PM (South Africa Standard Time, UTC+02:00)
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.