ASP.Net中的Session_End事件 [英] Session_End event in ASP.Net
本文介绍了ASP.Net中的Session_End事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨:)
我希望我的浏览器在关闭浏览器时结束...我知道我们可以使用session.Abondon(),但是应该在哪种情况下放置...
您还有其他选择吗?
在会话超时时,如果我想向用户显示会话已过期"消息,请问……我该怎么办?
:) Thnx
Hi :)
I want my session to end when i close the browser ... I know we can use session.Abondon() but in which event should i put...
Do you have another option?
And on session timeout if i want to show a message to the user saying "Session Expired" o smthing ... How do i do tat?
:) Thnx
推荐答案
此代码仅在IE中有效.
试试这个,
javascript:
This code will work only in IE.
Try this,
javascript:
function fnOnunLoad() {
if (window.event.clientX < 0 || window.event.clientY < 0) {
document.getElementById("ctl00_lnkLogout").click();
}
}
然后在body标签中使用它,
Then in body tag use this,
<body onunload="fnOnunLoad()">
如果您在注销按钮单击中编写了session.Abondon()代码,则该javascript将调用此注销单击功能.
If you written the session.Abondon() code in logout button click, then that javascript will call this logout click function.
您还可以执行其他操作.看看下面的链接
点击此处
There is one more that you can follow. Have a look to following link
Click here
这篇关于ASP.Net中的Session_End事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文