public bool Authenticate(loginentity le)
 {
     if (le.password.Length < 2)
     {
         throw new Exception("Password format incorrect");
     }
     else
     {
         return(dal.Authenticate(le));
     }
 }
Example #2
0
 public bool Authenticate(loginentity le)
 {
     try
     {
         TrainingDBEntities db = new TrainingDBEntities();
         var data = (from t in db.RegisterShoppings
                     where t.Id == le.userid && t.passw == le.password
                     select t).SingleOrDefault();
         if (data == null)
         {
             throw new Exception("Invalid credentials");
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(true);
 }
        protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            loginentity le = new loginentity();

            le.userid   = int.Parse(Login1.UserName);
            le.password = Login1.Password;
            loginbal bal = new loginbal();

            try
            {
                var res = bal.Authenticate(le);
                if (res)
                {
                    //Login1.FailureText = "Login Details Valid";
                    FormsAuthentication.RedirectFromLoginPage(le.userid.ToString(), true);
                }
            }
            catch (Exception ex)
            {
                Login1.FailureText = ex.Message;
            }
        }