protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] != null) { var cUser = Utils.User.BestUser; if (cUser != null) { var sessguid = HttpContext.Current.Session["SessionGuid"]; if (sessguid != null) { BestField sguid = new BestField() { fieldName = "sessionguid", fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, fieldSize = 40 }; sguid.fieldValue = sessguid.ToString(); BestLogins bslog = new BestLogins(); List<BestField> bparam = new List<BestField>(); bparam.Add(sguid); bslog.LoadRows("sessionguid=?", bparam); if (bslog.TableRows.Count > 0) { bslog.logoutdate = DateTime.Now; bslog.CurrentRow.Save(); } } } } Session.Contents.Abandon(); }
private void logLogin(string username, bool valid, Guid? sessionGuid) { BestLogins login = new BestLogins(); login.UserName = username; login.serverip = HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"].ToString(); login.loginvalid = valid; login.sourceip = Request.UserHostAddress; login.additionalInfo = Request.UserAgent; if (sessionGuid.HasValue) { login.sessionguid = sessionGuid.Value; Session["BestSessionGuid"] = login.sessionguid; } login.CurrentRow.Save(); }