Constraint ModelState.IsValid in ASP.NET MVC 3

I always use ModelState.IsValid to verify that the entire validation of my model on the server side is correct, but I think there is a restriction on its use. For example, I define the Remote Validation attribute, but if I turn off javascript , then ModelState.IsValid does not check the remote confirmation and always return true, where is the problem? Is this a limitation for ModelState.IsValid or is this my mistake? If necessary, I can add my entire implementation.

+4
source share
1 answer

This question has appeared several times. Answer: it is not checked on the server side, you need to perform the check action yourself. See also the following SO messages:

Of course, it would be nice to be able to check it on the server side. Fortunately, some good guy made an implementation for him. You can find his short blog post: http://www.tugberkugurlu.com/archive/asp-net-mvc-server-side-remote-validation .

+5
source

Source: https://habr.com/ru/post/1411241/


All Articles