如何处理浏览器关闭时的注销功能以及不在autopostback上注销的注销功能 [英] how to handle logout function on browser close and which do not logout on autopostback

查看:113
本文介绍了如何处理浏览器关闭时的注销功能以及不在autopostback上注销的注销功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PLZ帮帮我,我整晚都睡不着。

plz help me out, i can not sleep whole night.

推荐答案

如果不选择使用Session_End事件,你可以查看这个链接

http://stackoverflow.com/questions/1824421/detect-browser-close -on-asp-net [ ^ ]



希望这有助于...
You can check this link if not opting to use the Session_End event
http://stackoverflow.com/questions/1824421/detect-browser-close-on-asp-net[^]

Hope this helps...


我的母版页代码落后,写下条件as:



void Session_Start(object sender,EventArgs e)

{

Session [UserID] =;

}



请将此代码写在global.asax中



//此代码仅在您请求页面时执行。它只会执行一次。当用户关闭浏览器而没有注销时,当该用户将在那时再次出现时,此代码将重置用户的会话。

这将解决您的问题。

在主页面上加载你可以检查,



if(session [UserID]!=)

{

//登录代码

}

// ----------------------- -------

谢谢。
im master page code behind, write the condition as:

void Session_Start(object sender, EventArgs e)
{
Session["UserID"] = "";
}

kindly write this code in the global.asax

//this code will only execute when you will request for the page. it will execute only once. when user will close the browser, without logout, and when that user will come again at that time this code will reset the user's session.
This will solve your problem.
on master page load you can check,

if(session[UserID]!="")
{
// code for the login
}
//------------------------------
Thank you.


这篇关于如何处理浏览器关闭时的注销功能以及不在autopostback上注销的注销功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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