protected void Application_End(object sender, EventArgs e) { // 在应用程序关闭时运行的代码 sysUser sysuser = new sysUser(); MSysUser objsysuser = new MSysUser(); objsysuser.UserName = Session["loginName"].ToString(); objsysuser.SignState = false; sysuser.UpdateSysUserSignStateByUserName(objsysuser); }
protected void imgBtnLogonOut_Click(object sender, ImageClickEventArgs e) { if (Session["loginName"] != null) { sysUser user = new sysUser(); MSysUser objsysuser = new MSysUser(); objsysuser.UserName = Session["loginName"].ToString(); user.UpdateSysUserSignStateByUserName(objsysuser); } Session["loginName"] = null; Response.Redirect("~/Default.aspx"); }
protected void Session_End(object sender, EventArgs e) { // 在会话结束时运行的代码。 // 注意: 只有在 Web.config 文件中的 sessionstate 模式设置为 // InProc 时,才会引发 Session_End 事件。如果会话模式设置为 StateServer // 或 SQLServer,则不会引发该事件。 sysUser sysuser = new sysUser(); MSysUser objsysuser = new MSysUser(); objsysuser.UserName = Session["loginName"].ToString(); objsysuser.SignState = false; sysuser.UpdateSysUserSignStateByUserName(objsysuser); Application.Lock(); int iNum = Int32.Parse(Application["online"].ToString()) - 1; Application.Set("online", iNum); Application.UnLock(); }