The code which is generally generated for a ASP.NET MVC 3 Membership, escpecially the property NewPassword
of the class ChangePasswordModel
looks roughly like:
[Required]
[StringLength(100, MinimumLength=6)]
[DataType(DataType.Password)]
[Display("Name = CurrentPassword")]
public string NewPassword { get; set; }
In order to to fill some information with external parameters I am using RecourceType:
(In this case I am changing OldPassword
and fill the attribute Display
with some additional Data from a Resource
[Required]
[DataType(DataType.Password)]
[Display(ResourceType = typeof(Account), Name = "ChangePasswordCurrent")]
public string OldPassword { get; set; }
Back to NewPassword
. How can I substitute the MinimumLenght
with Membership.MinRequiredPasswordLength
? : My attempt:
[Required]
[StringLength(100, MinimumLength=Membership.MinRequiredPasswordLength)]
[DataType(DataType.Password)]
[Display(ResourceType=typeof(Account), Name= "ChangePasswordNew")]
public string NewPassword { get; set; }
This produces the error:
An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type (http://msdn.microsoft.com/de-de/library/09ze6t76%28v=vs.90%29.aspx)