protected void btnLogin_Click(object sender, EventArgs e) { Session["UserID"] = null; Session["UserName"] = null; #region varify login UserInfo userInfo = new UserInfo(); userInfo.UserName = this.TxtUserName.Text.Trim(); userInfo.Password = this.TxtPassword.Text.Trim(); UserInfo_BLL userInfoBll = new UserInfo_BLL(); UserInfo result = userInfoBll.CheckUserInfoByUserNameAndPassword(userInfo); #endregion if (result != null && result.UserID > 0)// after login redirect MyDetails { Session["UserID"] = result.UserID; Session["UserName"] = result.UserName; Response.Redirect("~/Pages/User/MyDetails.aspx"); } else { lblError.Text = "User Name or Password Incorrect."; } }
protected void autoLogin() { Session["UserID"] = null; Session["UserName"] = null; #region varify login UserInfo userInfo = new UserInfo(); userInfo.UserName = this.TxtUserName.Text.Trim(); userInfo.Password = this.TxtPassword.Text.Trim(); UserInfo_BLL userInfoBll = new UserInfo_BLL(); UserInfo result = userInfoBll.CheckUserInfoByUserNameAndPassword(userInfo); #endregion Session["UserID"] = result.UserID; Session["UserName"] = result.UserName; Response.Redirect("~/Default.aspx"); }