How do I pass a value from Membership Provider (taken from web.config) to Validation Attributes in AccountModels in default MVC 3 project?
Membership.MinRequiredPasswordLength
returns value obtained from web.config and Register.cshtml view uses it:
<p>
Passwords are required to be a minimum of @Membership.MinRequiredPasswordLength
characters in length.
</p>
But it seems that ViewModel in AccountModels file have the values hard-coded in:
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "New password")]
public string NewPassword { get; set; }
So how do I pass the value from web.config to MinimumLength parameter?