Skip to content

Instantly share code, notes, and snippets.

@mahizsas
Created October 24, 2012 00:42
Show Gist options
  • Save mahizsas/3943025 to your computer and use it in GitHub Desktop.
Save mahizsas/3943025 to your computer and use it in GitHub Desktop.
ASP.NET - Kill session cookie
var sessionCookie = new HttpCookie("ASP.NET_SessionId", string.Empty);
sessionCookie.Expires = DateTime.Now.AddDays(-1);
sessionCookie.Domain = UrlInformation.GetHostDomain(HttpContext.Current.Request.Url.Host);
HttpContext.Current.Response.Cookies.Add(sessionCookie);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment