コード例 #1
0
        private void Authenticate()
        {
            Console.WriteLine("Login");
            PrintStars();
            try
            {
                Console.WriteLine("Enter Username");
                username = Console.ReadLine();
                Console.WriteLine("Enter Password");
                password = Console.ReadLine();

                var result = bal.Authenticate(username, password);


                if (result == "Admin")
                {
                    AdminModule.AdminMenu am = new AdminModule.AdminMenu();
                    am.MenuAdmin();
                }
                if (result == "User")
                {
                    UserModule.UserMenu um = new UserModule.UserMenu();
                    um.MenuUser();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #2
0
ファイル: Login.aspx.cs プロジェクト: dakshinyaanand/example8
        protected void Login1_Authenticate1(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(), false);
                }
            }
            catch (Exception ex)
            {
                Login1.FailureText = ex.Message;
            }
        }
コード例 #3
0
        protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            try
            {
                entity.MobNo    = long.Parse(Login1.UserName);
                entity.Password = Login1.Password;

                var res = bal.Authenticate(entity);

                if (res)
                {
                    FormsAuthentication.RedirectFromLoginPage(Login1.UserName, false);
                }
                else
                {
                    Login1.FailureText = "Invalid credentials";
                }
            }
            catch (Exception ex)
            {
                Login1.FailureText = ex.Message;
            }
        }