Base solution for your next web application
Open Closed

Globally disable validation #3977


User avatar
0
carelearning created

Hello,

We see that we can turn validation off via an attribute here: [https://aspnetboilerplate.com/Pages/Documents/Validating-Data-Transfer-Objects#disabling-validation]) We would like to disable this globally. We are using javascript calls and MVC forms in various combination. Then we perform our own business-specific validation server-side. If a piece of data is null or undefined then it gets an error that says "....A value is required but was not present...." We want to write custom validation to catch this. Is there a way to turn this validation off globally?


1 Answer(s)
  • User Avatar
    0
    carelearning created

    We found an answer here: [https://forum.aspnetboilerplate.com/viewtopic.php?f=2&t=2947&p=7317&hilit=disable+ValidationConfiguration+Configuration.Validation#p7317]) We had to add

    Configuration.Modules.AbpWebApi().IsValidationEnabledForControllers = false;
    

    to disable validation on the services.