How to sign out from authentication in asp. Net
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Abhishek YadavRank #217 · 11.3K reputationPosted Nov 1, 2022, 8:49 AM EDT
https://www.aspsnippets.com/Articles/FormsAuthenticationSignOut-in-ASPNet-MVC.aspx
Sachin SinghRank #66 · 26.2K reputationPosted Nov 1, 2022, 12:56 AM EDT
If you are talking about webforms
If the above doesn't work then use below code
FormsAuthentication.SignOut(); Session.Abandon(); HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, ""); cookie.Expires = DateTime.Now.AddYears(-1); Response.Cookies.Add(cookie);Vishal YelveRank #178 · 13.6K reputationPosted Nov 1, 2022, 3:51 AM EDT
https://www.aspsnippets.com/Articles/FormsAuthenticationSignOut-in-ASPNet-MVC.aspx