ASP.Net注销code座 [英] ASP.Net logout code block

查看:181
本文介绍了ASP.Net注销code座的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要asp.net一个良好的退出code座。您注销后目前你可以打后退按钮并继续使用该网站。

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.

推荐答案

您需要确保该会话被放弃,并调用 FormsAuthentication.SignOut()方法如下图所示:

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();
}

这篇关于ASP.Net注销code座的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆