I got a problem in asp.net where a user after logging out can navigate back to the pages that he visited previously without again logging in. The problem comes because the pages are not retrieved from the server but stored in the browser cache.This is how i avoided it.
I included this code in the page load of each page
Response.Buffer = True
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1D)
Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")
Response.CacheControl = "no-cache"
If Not Page.User.Identity.IsAuthenticated Then
Response.Redirect("~/login.aspx", False)
End If
No comments:
Post a Comment