I'm new to .net and I'm stuck with a problem I want to validate my password field ,The password must be a alphanumericstring with special symbols and I wrote a code for that which is given below
[Required(ErrorMessage = "Password is required")]
[RegularExpression(@"^[a-zA-Z0-9~!@#$%^&*]{8,15}$", ErrorMessage = "Password is not in proper format")]
public virtual string Password { get; set; }
But its not working if the password length is greater than 8 then its gives green signal for the string even its only contain alphabets. How can I overcome this problem