且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

注销后后退箭头

更新时间:2023-12-02 11:09:22

  Response.Cache.SetCacheability(HttpCacheability.NoCache);

I have an ASP.NET application using Forms Authentication. When the user clicks the Sign Out button on the page it runs the following code.

        FormsAuthentication.SignOut();
        Response.Expires = 0;
        Response.Cache.SetNoStore();
        Response.AppendHeader("Pragma", "no-cache");

However the user can still just press the back arrow and see the previous page without needing to log in again. I am sure it has something to do with the previous page being cached. How can I make sure they are prompted to log in again with going back?

Response.Cache.SetCacheability(HttpCacheability.NoCache);