private bool LoginByCookie() { try { HttpCookie cookie = Request.Cookies["FINFLoginCookie"]; if (cookie != null) { _user = new FI.BusinessObjects.User(decimal.Parse(cookie.Value), false); _user.Login(true, Request.UserHostAddress, Session.SessionID); Session["User"] = _user; _message = null; return(true); } else { return(false); } } catch (Exception exc) { if (Common.AppConfig.IsDebugMode) { Common.LogWriter.Instance.WriteEventLogEntry(exc); } _message = exc.Message; ShowHeader(); return(false); } }
private void LoginByPassword() { try { _user = new FI.BusinessObjects.User(this.txtCompany.Text, this.txtLogin.Text, this.txtPassword.Text); _user.Login(this.chkForce.Checked, Request.UserHostAddress, Session.SessionID); Session["User"] = _user; // set cookie if (this.chkRemember.Checked) { HttpCookie cookie = new HttpCookie("FINFLoginCookie"); cookie.Value = _user.ID.ToString(); cookie.Expires = DateTime.Now.AddMonths(6); Response.Cookies.Add(cookie); } _message = null; } catch (Exception exc) { if (Common.AppConfig.IsDebugMode) { Common.LogWriter.Instance.WriteEventLogEntry(exc); } _message = exc.Message; ShowHeader(); } }
private void btnLogin_Click(object sender, System.EventArgs e) { try { _user=new FI.BusinessObjects.User(this.txtCompany.Text , this.txtLogin.Text , this.txtPassword.Text); _user.Login(this.chkForce.Checked, Request.UserHostAddress , Session.SessionID); Session["User"]=_user; _message=null; } catch(Exception exc) { if(Common.AppConfig.IsDebugMode) Common.LogWriter.Instance.WriteEventLogEntry(exc); _message=exc.Message; ShowHeader(); } }
protected void btnLogin_Click(object sender, System.EventArgs e) { try { _user = new FI.BusinessObjects.User(this.txtCompany.Text, this.txtLogin.Text, this.txtPassword.Text); _user.Login(this.chkForce.Checked, Request.UserHostAddress, Session.SessionID); Session["User"] = _user; _message = null; } catch (Exception exc) { if (Common.AppConfig.IsDebugMode) { Common.LogWriter.Instance.WriteEventLogEntry(exc); } _message = exc.Message; ShowHeader(); } }