asp.net handling Back button event after Logout

前端 未结 2 497
执念已碎
执念已碎 2020-12-10 23:07

In the logout link button click event I have cleared the session variables. I am checking these session variables for null values at each page\'s load event. If it has the n

相关标签:
2条回答
  • 2020-12-10 23:44

    Try this code, hope it works

    Response.Cache.SetCacheability(HttpCacheability.NoCache);

    Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));

    Response.Cache.SetNoStore();

    0 讨论(0)
  • 2020-12-10 23:47

    You will need to make sure the pages behind the login (those that can only be accessed after login) are not cached in the browser:

    Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);
    

    If using forms authentication, you will also need to abandon the session and logout:

    Session.Abandon();
    FormsAuthentication.SignOut();
    

    See this, this and this.

    0 讨论(0)
提交回复
热议问题