After the User signout, I can still use previous cookies using postman to access app resources.
My method
public void ClearCookieAndSessionData()
{
Session.Clear();
//session.abandon();
Session.RemoveAll();
// clear authentication cookie
HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, "");
authCookie.Expires = DateTime.Now.AddYears(-1);
Response.Cookies.Add(authCookie);
// clear session cookie
HttpCookie sessionCookie = new HttpCookie("ASP.NET_SessionId", "");
sessionCookie.Expires = DateTime.Now.AddYears(-1);
Response.Cookies.Add(sessionCookie);
HttpCookie aspCookies = new HttpCookie(".AspNet.Cookies", "");
aspCookies.Expires = DateTime.Now.AddYears(-1);
Response.Cookies.Add(aspCookies);
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
}
Need to implement: If the user signout then we can not access the app with previous cookies
Test code: https://github.com/amitsinghrawat1994/SignoutIssue The above code is generated by visual studio asp net MVC (.net framework) with Authentication option Individual User Account option.
is there any idea how I can stop access by previous cookies?