asp.net handling Back button event after Logout

前端 未结 2 496
执念已碎
执念已碎 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: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.

提交回复
热议问题