简体   繁体   English

表单身份验证登出

[英]FormsAuthantication sign out

I have an asp.net application, and I am using FormsAuthantication. 我有一个asp.net应用程序,并且正在使用FormsAuthantication。 When the user closes the page, the code located in Global.asax Session_End is executed : FormsAuthantication.SignOut(); 当用户关闭页面时,将执行位于Global.asax Session_End中的代码:FormsAuthantication.SignOut(); But the problem is, session is not ending, if the user tries to open a page with cookie, the page shouldn't be opened. 但是问题是,会话没有结束,如果用户尝试使用Cookie打开页面,则不应打开该页面。 User must be redirected to login page, but its not. 用户必须重定向到登录页面,但不是。 What can I do, what can be the problem? 我该怎么办,可能是什么问题?

declare a boolean variable and set a value while logging out, and write it into cookie. 声明一个布尔变量并在注销时设置一个值,然后将其写入cookie。 And then use that variable in page at cookie reading. 然后在读取cookie时在页面中使用该变量。 If the user push sign out, set it true, if user closes browser it will be false. 如果用户推送退出,请将其设置为true,如果用户关闭浏览器,则为false。 Declare default value false. 声明默认值false。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM