适用于任何浏览器的注销代码 [英] Logout code that works on any browser

查看:106
本文介绍了适用于任何浏览器的注销代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在我的项目中,我想编写注销代码,该代码可在任何浏览器上使用.我的问题是,当我登录到主页时,正在创建会话.因此,在每个页面中,我都要检查天气会话数(Session.Count> 0)是否存在会话数,这意味着我将重定向到登录屏幕,然后在注销中单击``我清除所有会话(Session.Abandon( )).这是遵循我所做工作的正确方法吗?

如果有任何建议,请建议我.

在此先感谢

Arun R.V

Hello everyone,

In my project I want to write logout code which will work on any browser . My problem is when I login into my home page I am creating session . So in each and every page i am going to check weather session count is there (Session.Count>0) if session count is not there means i am redirecting to login screen and in Logout click i am clearing All Session (Session.Abandon()) . Is this proper way to follow what I have done .

If any suggestions are there means please suggest me .

Thanks in advance

Arun R.V

推荐答案

登录/注销从未使用JavaScript完成,因为它是不安全的.服务器不在乎您使用哪种浏览器.

因此,您可以使用网络上的任何教程.我建议您犁一些.
Login/out is never done using JavaScript, since it would be insecure. The server does not care what browser you use.

You can therefore use any of the tutorials on the web. I suggest you plough trough some.


我相信正确的方法是当用户单击注销按钮时调用Session.Abandon()方法.

公共无效LogOut()
{
Session.Abandon();
}

Session.Abandon()破坏了会话.
理想情况下,用户注销后可以立即调用上述方法,然后再次重定向到登录"页面.

问候,
拉维
I believe the proper way would be to call Session.Abandon() Method when user clicks on logout button.

Public void LogOut()
{
Session.Abandon();
}

Session.Abandon() destroys the session.
Ideally as soon as user logged out you can call the above method and then redirect again to Login page.

Regards,
Ravi


这篇关于适用于任何浏览器的注销代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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