String MinLength and MaxLength validation don't work (asp.net mvc)

前端 未结 5 2013
慢半拍i
慢半拍i 2020-12-12 20:27

I have this class

using System.ComponentModel.DataAnnotations;
using Argussoft.BI.DAL.Domain.Users;

namespace Argussoft.BI.DAL.DTOs.UserDTOs
{
    public cl         


        
5条回答
  •  死守一世寂寞
    2020-12-12 21:07

    This can replace the MaxLength and the MinLength

    [StringLength(40, MinimumLength = 10 , ErrorMessage = "Password cannot be longer than 40 characters and less than 10 characters")]
    

提交回复
热议问题