本文介绍了自动注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好, 我有一个登录表单和更多表格。我需要在用户刷新或按后退按钮时自动注销或关闭浏览器如何执行此操作?在此先感谢。Hi all, I have a login form and some more forms for the process. I need to log off automatically when the user refresh or press back button or closes the browser how to perform this? Thanks in advance.推荐答案<authentication mode="Forms"><forms loginUrl="Login.aspx" protection="All" timeout="3000"></forms></authentication> 所以也许你的应用程序托管在IIS中不要担心我们有其他解决方案,请按照以下步骤操作: 1)请在运行中使用此命令inetmgr打开您的IIS 2)展开默认网站并右键单击您的网站/ Proerties 3)在网站属性对话框中,转到ASP.Net选项卡,单击编辑配置按钮 4)在ASP.Net配置设置对话框中,转到状态管理选项卡并增加会话超时(分钟) of cour你应该使用 FormsAuthentication.SignOut 你可以在这里获得更多相关信息:http://msdn.microsoft.com/en-us/library/system.web.security .formsauthentication.signout.aspx?cs-save-lang = 1& cs-lang = csharp#code-snippet-2。So maybe your application is hosted in IIS don`t worry we have a other solution for it please follow these steps:1) Please open your IIS with this command "inetmgr" in run2) Expand Default Web site and Right Click on your Web Site/Proerties3) In the Web Site Properties dialog box go to ASP.Net tab click on Edit Configuration button4) In the ASP.Net Configuration Setting dialog box go to State Management Tab and Increase the Session timeout (minutes)Of course you should use FormsAuthentication.SignOut you can get more information about it here: http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.signout.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2.public void Login_OnClick(object sender, EventArgs args){ FormsAuthentication.SignOut(); FormsAuthentication.RedirectToLoginPage();} 因此,当用户刷新页面时,您可以使用这些方法退出;) 最好的问候。So you can use these method for sign out when the user refresh the page ;)Best Regards. 这篇关于自动注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!