protected void LogIn(object sender, EventArgs e) { using (BsolutionDBDataContext DB = new BsolutionDBDataContext()) { //var button = DB.Users.Where(a => a.Username.Equals(txtUsername.Text) && a.password.Equals(txtPassword.Text)); //if (button.Count() > 0) //{ // var user = button.First(); // //Labelusername.Text = user.Name; // ////Session["UserID"] = user.ID; // //Labeluserid.Text = Convert.ToString(user.ID); //} //else //{ // //Labeluserid.Text = "0"; // //// Session["UserID"] = 0; // //Labelusername.Text = "None, Please Login"; // //Labelstatuslogin.Text = "LoginFailed"; //} } Response.Redirect("~/Pages/AdminPages/Home.aspx?user="******"ReturnUrl"], Response); // break; // case SignInStatus.LockedOut: // Response.Redirect("/Account/Lockout"); // break; // case SignInStatus.RequiresVerification: // Response.Redirect(String.Format("/Account/TwoFactorAuthenticationSignIn?ReturnUrl={0}&RememberMe={1}", // Request.QueryString["ReturnUrl"], // RememberMe.Checked), // true); // break; // case SignInStatus.Failure: // default: // FailureText.Text = "Invalid login attempt"; // ErrorMessage.Visible = true; // break; // } //} }
protected void LogIn(object sender, EventArgs e) { using (BsolutionDBDataContext DB = new BsolutionDBDataContext()) { var button = DB.Users.Where(a => a.Username.Equals(Email.Text) && a.password.Equals(Password.Text)); if (button.Count() > 0) { var user = button.First(); //Labelusername.Text = user.Name; ////Session["UserID"] = user.ID; //Labeluserid.Text = Convert.ToString(user.ID); Session["userid"] = "" + user.ID; Session["name"] = "" + user.Name; Response.Redirect("~/Pages/AdminPages/Home.aspx"); } else { //Labeluserid.Text = "0"; //// Session["UserID"] = 0; //Labelusername.Text = "None, Please Login"; Labelstatus.Text = "LoginFailed,Please Enter Password and UserName Correctly"; } } }
protected void user_Load(object sender, EventArgs e) { using (BsolutionDBDataContext DB = new BsolutionDBDataContext()) { var button = DB.Users.Where(a => a.Username.Equals(txtUsername.Text) && a.password.Equals(txtPassword.Text)); if (button.Count() > 0) { var user = button.First(); Labelusername.Text = user.Name; //Session["UserID"] = user.ID; Labeluserid.Text = Convert.ToString(user.ID); Session["userid"] = "" + user.ID; Session["name"] = "" + user.Name; } else { Labeluserid.Text = "0"; // Session["UserID"] = 0; Labelusername.Text = "None, LoginFailed"; Labelstatuslogin.Text = "LoginFailed"; Session["userid"] = "0"; } } }