hash - ASP.NET MVC DataAnnotations StringLength On Password ModelState.IsValid Fails When Hashed -
first question is, using stringlength, possible specify minimum length? more importantly, have password.
private string password; [required] [datatype(datatype.password)] [stringlength(15, minimumlength = 6)] public string password { { return password; } set { hashpassword(value); } } what want when user enters password can enter minimum of 6 , maximum of 15 characters password. issue lies in controller because modelstate.isvalid fails due hashing generating huge string exceeding 15 characters. how can around this?
i recommend doing hashing elsewhere (e.g. in controller) instead of doing in set accessor of property.
Comments
Post a Comment