ASP.Net logout code block

谁说胖子不能爱 提交于 2019-11-29 21:11:50

问题


I need a good logout code block for asp.net. Currently after you logout you can hit the back button and continue using the site.


回答1:


You need to make sure that the session is abandoned and call the FormsAuthentication.SignOut() method as shown below:

private void Logout()
{
  Session.Abandon();
  FormsAuthentication.SignOut();
  FormsAuthentication.RedirectToLoginPage();
}



回答2:


Assuming you're using Forms Authentication, you would just do:

System.Web.FormsAuthentication.SignOut();

Without more information I can't be more specific.



来源:https://stackoverflow.com/questions/981571/asp-net-logout-code-block

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!