关闭Window后清除会话 [英] Clear Session after closing Window

查看:91
本文介绍了关闭Window后清除会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如果有人关闭窗口而没有点击退出那么如何清除会话?

有人可以告诉我吗?

Bcoz I想要在登录和注销按钮的数据库中设置状态。

解决方案



使用

会话。在关闭窗口之前清除()


 HttpContext.Current.Session.Abandon(); 
Session.Abandon();
Session.Contents.Clear();







在void Session_End(对象中)写这个global.asax文件中的sender,EventArgs e)方法


如果用户关闭浏览器,那么如果用户关闭选项卡会话将自动为空



http://www.google.co.in/#biw=1024&bih=677&sclient=psy-ab&q=clear%20session%20using%20javascript%20in%20asp.net&oq=&gs_l=&pbx=1&bav=on.2, or.r_qf。&BVM = bv.48705608,d.bmk&FP = 454708d46e718598&PF = p&PDL = 300

Hi,
If anybody closed window without clicking on logout then how to clear session?
Can anybody tell me?
Bcoz I want to set status in database on login and logout button.

解决方案

Hi,
use
Session.Clear()
before closing window


HttpContext.Current.Session.Abandon();
Session.Abandon();
Session.Contents.Clear();




write this in void Session_End(object sender, EventArgs e) method in global.asax file


if user close browser then session will be null automatically if user close tab then

http://www.google.co.in/#biw=1024&bih=677&sclient=psy-ab&q=clear%20session%20using%20javascript%20in%20asp.net&oq=&gs_l=&pbx=1&bav=on.2,or.r_qf.&bvm=bv.48705608,d.bmk&fp=454708d46e718598&pf=p&pdl=300


这篇关于关闭Window后清除会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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