protected void btnLogin_Click(object sender, EventArgs e) { clsBusinessLayer myBusinessLayer = new clsBusinessLayer(Server.MapPath("~/App_Data/")); bool isValidUser = myBusinessLayer.CheckUserCredentials(Session, txtUserID.Text, txtPassword.Text); //checking if valid customer if (isValidUser) { //redirct page Response.Redirect("~/pgCheckOut.aspx"); } else if (Convert.ToBoolean(Session["LockedSession"])) { Master.UserFeedBack.Text = "Account is disabled. Contact System Administrator"; //hide login button btnLogin.Visible = false; } else { //result message error Master.UserFeedBack.Text = "The User ID and/or Password supplied is incorrect. Please try again!"; } }
// login button functionality protected void btnLogin_Click(object sender, EventArgs e) { // business path clsBusinessLayer myBusinessLayer = new clsBusinessLayer(Server.MapPath("~/App_Data/")); // is user valid bool isValidUser = myBusinessLayer.CheckUserCredentials(Session, txtUserID.Text, txtPassword.Text); // if valid if (isValidUser) { // if valid redirect Response.Redirect("~/pgUserDetailsConfirm.aspx"); } else if (Convert.ToBoolean(Session["LockedSession"])) { Master.UserFeedBack.Text = "Account is disabled. Contact your System Administrator! "; // hide login btnLogin.Visible = false; } else { // incorrect user Master.UserFeedBack.Text = "The User ID and/or Password is incorrect. Please try again! "; } }
// *Updated Method to process the login credentials for authentication and authorization // No longer redirects to login page after successful login protected void btnLogin_Click(object sender, EventArgs e) { // Users.accdb is in App_Data // Please verify that your data directory path is correct!!!! clsBusinessLayer myBusinessLayer = new clsBusinessLayer(Server.MapPath("~/App_Data/")); // Cross reference for authorization bool isValidUser = myBusinessLayer.CheckUserCredentials(Session, txtUserID.Text, txtPassword.Text); // If the user checks out, then they will go to check out page if (isValidUser) { // Redirection page Response.Redirect("~/AccDetails.aspx"); } else if (Convert.ToBoolean(Session["LockedSession"])) { Master.UserFeedBack.Text = "Account is disabled. Contact System Administrator"; // Hide login button :-) btnLogin.Visible = false; } else { // Adds an attempt as failure message is displayed Master.UserFeedBack.Text = "The User ID and/or Password supplied is incorrect. Please try again!"; } }
protected void btnLogin_Click(object sender, EventArgs e) { // Create new instant of the BusinessLayer clsBusinessLayer myBusinessLayer = new clsBusinessLayer(Server.MapPath("~/App_Data/")); // Checks session credentials with database bool isValid = myBusinessLayer.CheckUserCredentials(Session, txtUserID.Text, txtPassword.Text); // Checks session credentials with database bool isValidUser = myBusinessLayer.CheckUsername(Session, txtUserID.Text); // If the user is in the database then they proceed if (txtUserID.Text == null || txtUserID.Text == String.Empty || txtPassword.Text == null || txtPassword.Text == String.Empty) { Response.Redirect("~/pgLogin.aspx"); if (isValid) { lblCurrentUser.Text = User.Text; } } else if (Convert.ToBoolean(Session["LockedSession"])) { Master.UserFeedBack.Text = "Account is disabled. Contact System Administrator"; // Hide login button btnLogin.Visible = false; } else { Master.UserFeedBack.Text = "The User ID and/or Password supplied is incorrect. Please try again!"; } }
protected void btnLogin_Click(object sender, EventArgs e) { //Accesses App_Data directory in the clsBusinessLayer.cs business layer clsBusinessLayer myBusinessLayer = new clsBusinessLayer(Server.MapPath("~/App_Data/")); //Accesses isValidUser method in business layer for user credentials bool isValidUser = myBusinessLayer.CheckUserCredentials(Session, txtUserName.Text); //if user is valid then it redirects to the frmRegister.aspx page if (isValidUser) { //Redirects to the frmRegister.aspx page Response.Redirect("~/frmRegister.aspx"); } else if (Convert.ToBoolean(Session["LockedSession"])) { Master.UserProgrammer.Text = "Account is disabled. Contact System Administrator"; //Hides login button visibility btnLogin.Visible = false; } else { //Creates incorrect login message Master.UserProgrammer.Text = "The User ID and/or Password supplied is incorrect. Please try again!"; } }
protected void btnLogin_Click(object sender, EventArgs e) { clsBusinessLayer myBusinessLayer = new clsBusinessLayer(Server.MapPath("~/App_Data/")); bool isValidUser = myBusinessLayer.CheckUserCredentials(Session, txtUsername.Text, txtPassword.Text); if (isValidUser) { Session["NewUser"] = false; Session["SessionUsername"] = txtUsername.Text; Response.Redirect("~/pgUserDetails.aspx"); } else if (Convert.ToBoolean(Session["LockedSession"])) { Master.UserFeedBack.Text = "Too many incorrect attempts, login disabled!"; btnLogin.Visible = false; } else { Master.UserFeedBack.Text = "The Username and Password entered are incorrect. Try again."; } }
protected void btnLogin_Click(object sender, EventArgs e) { // Create new instant of the BusinessLayer clsBusinessLayer myBusinessLayer = new clsBusinessLayer(Server.MapPath("~/App_Data/")); // Checks session credentials with database bool isValid = myBusinessLayer.CheckUserCredentials(Session, txtUserID.Text, txtPassword.Text); try { // If the user is in the database then they proceed if (isValid) { lblCurrentUser.Text = txtUserID.Text; panelCatalog.Visible = true; Master.AboutUs.Visible = true; Master.AccountDetails.Visible = true; Master.Checkout.Visible = true; Master.FAQ.Visible = true; Master.HomePage.Visible = true; Master.Login.Visible = true; Master.OrderReview.Visible = false; Master.AboutUs.Enabled = true; Master.AccountDetails.Enabled = true; Master.Checkout.Enabled = true; Master.FAQ.Enabled = true; Master.HomePage.Enabled = true; Master.Login.Enabled = true; Master.OrderReview.Enabled = false; panelCatalog.Enabled = true; panelCatalog.Visible = true; panelReLogin.Enabled = false; panelReLogin.Visible = false; // Output message if match data is found Master.UserFeedBack.Text = "Welcome " + lblCurrentUser.Text + "!"; if (lblCurrentUser.Text.Contains("systemAdmin")) { Master.OrderReview.Visible = true; // Output message if match data is found Master.UserFeedBack.Text = "Welcome " + lblCurrentUser.Text + "!"; } } else if (Convert.ToBoolean(Session["LockedSession"])) { Master.UserFeedBack.Text = "Account is disabled. Contact System Administrator"; // Hide login button btnLogin.Visible = false; } else { Master.UserFeedBack.Text = "The User ID and/or Password supplied is incorrect. Please try again!"; } } catch (Exception error) { Master.UserFeedBack.Text = error.Message; } }