登出網頁之後:
Session.RemoveAll()
Session.Abandon()
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = DateAdd(DateInterval.Minute, -1, Now())
Response.CacheControl = "no-cache"
Response.Redirect("login.aspx")
只要USER按上一頁還是可以看到未登出的資料,
在Global.asax.vb 中的Application_BeginRequest
加上一行:
HttpContext.Current.Response.Cache.SetNoStore()
就可以防止回上一頁了.
如果只要針對某些網頁可以改為:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Response.Cache.SetNoStore()
......
End If
End Sub