The following post explains exactly how to globally handle validation errors thrown by the ASP .NET core framework.

Centralized exception handling and request validation in ASP.NET Core


Validation errors will not trigger the “UseExceptionHandler”.

If you want to change the response for validation errors you will have to configure the “ApiBehaviorOptions”


    .AddJsonOptions(option => option.SerializerSettings.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Local)



services.Configure<ApiBehaviorOptions>(options =>


    options.InvalidModelStateResponseFactory = ctx => new ValidationProblemDetailsResult(_logger);


p style=”background: #1e1e1e”>});



Read “” for more details.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.