本文介绍了我想在关闭浏览器时清除会话值,并更新状态以注销数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
每当我关闭浏览器并重新打开会话值时,便在global.asax(application_end)中编写了以下代码,会话值未清除并且状态在数据库中显示为空.
I wrote below code in global.asax(application_end) whenever i closed the browser and reopens the session values are not clearing and status is showing null in database.
string strlogout = "logout";
//updatelogouttime();
// public void updatelogouttime()
//{
Empbusinessaccesslayer obj = new Empbusinessaccesslayer();
obj.Empname = Session["Username"].ToString();
obj.Ipaddress = Session["ipaddress"].ToString();
DateTime dt = (DateTime)Session["logintime"];
obj.Createddate = Convert.ToDateTime(Session["logindate"].ToString());
obj.Jobposteddate = dt;
obj.Comptypeid = int.Parse(Session["comptypeid"].ToString());
obj.Curremployer = strlogout;
obj.updateuserlogout(Session["Username"].ToString(), Session["ipaddress"].ToString(), Convert.ToDateTime(Session["logindate"].ToString()), dt, int.Parse(Session["comptypeid"].ToString()), strlogout);
Session["Username"] = null;
Session["empname"] = null;
Session["comptypeid"] = null;
Session.Contents.Clear();
Session.Abandon();
推荐答案
这篇关于我想在关闭浏览器时清除会话值,并更新状态以注销数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!