コード例 #1
0
        public static bool Login(IUserBusinessLogic userBll, HttpContextBase httpContext, string login, string password)
        {
            bool validCredentials = false;
            User user             = userBll.User_GetByLogin(login);

            if (user == null)
            {
                validCredentials = false;
            }
            else
            {
                validCredentials = PasswordHash.ValidatePassword(password, user.PasswordHash);
            }

            if (validCredentials)
            {
                SetAuthenticationCookie(httpContext, login);
                SetPrincipal(httpContext, login);
            }

            return(validCredentials);
        }