In an ASP.NET MVC 4 app, the LocalPasswordModel class (in Models\\AccountModels.cs) looks like this:
public class LocalPasswordModel
{
[Required]
[Da
For StringLengthAttribute, the message string can take 3 arguments:
{0} Property name
{1} Maximum length
{2} Minimum length
These parameters unfortunately do not seem to be well documented. The values are passed in from each validation attribute's FormatErrorMessage
attribute. For example, using .NET Reflector, here is that method from StringLengthAttribute
:
public override string FormatErrorMessage(string name)
{
EnsureLegalLengths();
string format = ((this.MinimumLength != 0) && !base.CustomErrorMessageSet) ? DataAnnotationsResources.StringLengthAttribute_ValidationErrorIncludingMinimum : base.ErrorMessageString;
return String.Format(CultureInfo.CurrentCulture, format, new object[] { name, MaximumLength, MinimumLength });
}
It is safe to assume that this will never change because that would break just about every app that uses it.