views:

51

answers:

1

I have a page that when you press 'log out' it will redirect to the login.aspx page which as an page_load method which calls FormsAuthentication.SignOut(). The master page displays the log out link in the top right of the screen and it displays it on the condition that Page.User.Identity.IsAuthenticated is true. After stepping through the code however, this signout method doesn't automatically set isAuthenticated to false which is quite annoying, any ideas?

A: 

I remember having a similar problem and I think I resolved it by expiring the forms authentication cookie at logout time:

FormsAuthentication.SignOut();
Response.Cookies[FormsAuthentication.FormsCookieName].Expires = DateTime.Now.AddYears(-1);
Patrick Steele