如何解决登出问题 [英] how to solve logout problem

查看:121
本文介绍了如何解决登出问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我登录到我的Web项目并进行一些交易.
当我再次运行应用程序而没有注销时,即使用户未注销,登录页面也会再次出现.

如何解决这个问题?
请指导我.

我的注销代码是

Hi
I login to my web project and make some transactions.
When I run application again without logging out the login page is coming up again even though the user is not logged out.

How to solve this one?
Please guide me.

my logout code is

logout_click()

FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
Session.Abandon();
Response.Redirect("loginpage");

推荐答案

关闭浏览器窗口时,身份验证票将丢失.您需要为此创建一个持久性cookie.

不知道您使用身份验证的方式.
如果您使用的是典型的
``FormsAuthentication.RedirectFromLoginPage()''函数,设置
第二个参数(将永久性cookie创建为true)例如:
FormsAuthentication.RedirectFromLoginPage("userName",true)

这将创建一个持久性cookie,并将与浏览器重启一起使用.
(不适用于其他浏览器).希望您了解Cookie的过期时间
When a browser window is closed, the authentication ticket is lost. You need to create a persistent cookie for this.

Don''t know the way you are using authentication.
If you''re using the typical
''FormsAuthentication.RedirectFromLoginPage()'' function, set the
second param(create persistent cookie to true) Eg:
FormsAuthentication.RedirectFromLoginPage("userName",true)

That''ll create a persistent cookie and will work with browser restarts.
(not for different browsers). Hope you know about the cookie expiration time


这篇关于如何解决登出问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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