top of page
Search

The best way to logout for ASP.NET?

  • Writer: Author
    Author
  • Jun 12, 2020
  • 1 min read

// Abandon all sessions
Session.Abandon();

// Signout
FormsAuthentication.SignOut();

// Mark all cookies as expired
string cookieName; 
int limit = Request.Cookies.Count; 
for (int i=0; i<limit; i++) 
{
    cookieName = Request.Cookies[i].Name;
    aCookie = new HttpCookie(cookieName);     
    aCookie.Expires = DateTime.Now.AddDays(-1);     
    Response.Cookies.Add(aCookie); 
}

References:


 
 
 

Recent Posts

See All
Download videos from PluralSight

Source: https://www.quora.com/Tutorials-How-can-I-download-PluralSight-training-videos Ahmad Ismail, Software Artisan & Bookworm Updated...

 
 
 

Comments


Post: Blog2_Post

Subscribe Form

Thanks for submitting!

  • LinkedIn

©2020 by There Is No Spoon. Proudly created with Wix.com

bottom of page