Server side validation with custom DataAnnotationsModelValidatorProvider

前端 未结 1 1606
醉话见心
醉话见心 2021-01-03 04:34

I have setup a custom provider to allow setting validation attributes from a data store instead of in static code. Works great with the client side validation in my .NET MV

相关标签:
1条回答
  • 2021-01-03 05:19

    I finally figured this out, it's a pretty simple answer. The ApiControllers only respond to the providers in the System.Web.Http.Validation namespace, not the System.Web.Mvc namespace that is used for regular Controllers and the client side validation.

    I implemented both to achieve both the client side validation and server validation in the ApiControllers.

    0 讨论(0)
提交回复
热议问题