ValidateRequiredStringValue() public static method

public static ValidateRequiredStringValue ( string value, string parameterName ) : void
value string
parameterName string
return void
Exemplo n.º 1
0
        public bool ValidateUser(string userName, string password)
        {
            ValidationUtil.ValidateRequiredStringValue(userName, "userName");
            ValidationUtil.ValidateRequiredStringValue(password, "password");

            return(_provider.ValidateUser(userName, password));
        }
Exemplo n.º 2
0
        public MembershipCreateStatus CreateUser(string userName, string password, string email)
        {
            ValidationUtil.ValidateRequiredStringValue(userName, "userName");
            ValidationUtil.ValidateRequiredStringValue(password, "password");
            ValidationUtil.ValidateRequiredStringValue(email, "email");

            MembershipCreateStatus status;

            _provider.CreateUser(userName, password, email, null, null, true, null, out status);
            return(status);
        }
Exemplo n.º 3
0
        public bool ChangePassword(string userName, string oldPassword, string newPassword)
        {
            ValidationUtil.ValidateRequiredStringValue(userName, "userName");
            ValidationUtil.ValidateRequiredStringValue(oldPassword, "oldPassword");
            ValidationUtil.ValidateRequiredStringValue(newPassword, "newPassword");

            // The underlying ChangePassword() will throw an exception rather
            // than return false in certain failure scenarios.
            try {
                MembershipUser currentUser = _provider.GetUser(userName, true /* userIsOnline */);
                return(currentUser.ChangePassword(oldPassword, newPassword));
            }
            catch (ArgumentException) {
                return(false);
            }
            catch (MembershipPasswordException) {
                return(false);
            }
        }
Exemplo n.º 4
0
        public void SignIn(string userName, bool createPersistentCookie)
        {
            ValidationUtil.ValidateRequiredStringValue(userName, "userName");

            FormsAuthentication.SetAuthCookie(userName, createPersistentCookie);
        }