© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
21 replies
barcode

Error validation [Answered]

   [Required]
    [MinLength(8, ErrorMessage = "Password too short")]
    [MaxLength(32, ErrorMessage ="Password too long")]
    public string Password { get; set; }
   [Required]
    [MinLength(8, ErrorMessage = "Password too short")]
    [MaxLength(32, ErrorMessage ="Password too long")]
    public string Password { get; set; }


I have this in my Dto and when validation is invalid I get this for example

{
    "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
    "title": "One or more validation errors occurred.",
    "status": 400,
    "traceId": "00-7e6431d39d15726ab988a4d46bcfec16-79d8864992a8a975-00",
    "errors": {
        "Password": [
            "Password too short"
        ]
    }
}
{
    "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
    "title": "One or more validation errors occurred.",
    "status": 400,
    "traceId": "00-7e6431d39d15726ab988a4d46bcfec16-79d8864992a8a975-00",
    "errors": {
        "Password": [
            "Password too short"
        ]
    }
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

start error [Answered]
C#CC# / help
4y ago
Script error [Answered]
C#CC# / help
4y ago
Compiler error [Answered]
C#CC# / help
4y ago