Skip to content

Instantly share code, notes, and snippets.

@johnathan-sewell
Created June 2, 2011 09:33
Show Gist options
  • Save johnathan-sewell/1004173 to your computer and use it in GitHub Desktop.
Save johnathan-sewell/1004173 to your computer and use it in GitHub Desktop.
Clear persistent login tickets in ASP.NET
private void ClearAnyPersistentCookies() {
var cookie = Request.Cookies.Get(FormsAuthentication.FormsCookieName);
if (cookie == null) return;
var ticket = FormsAuthentication.Decrypt(cookie.Value);
if (ticket == null) return;
if (ticket.IsPersistent)
FormsAuthentication.SignOut();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment