[removed] client-side vs. server-side validation

后端 未结 13 763
余生分开走
余生分开走 2020-11-21 11:58

Which is better to do client side or server side validation?

In our situation we are using

  • jQuery and MVC.
  • JSON data to pass between our Vi
13条回答
  •  一生所求
    2020-11-21 12:07

    The benefit of doing server side validation over client side validation is that client side validation can be bypassed/manipulated:

    • The end user could have javascript switched off
    • The data could be sent directly to your server by someone who's not even using your site, with a custom app designed to do so
    • A Javascript error on your page (caused by any number of things) could result in some, but not all, of your validation running

    In short - always, always validate server-side and then consider client-side validation as an added "extra" to enhance the end user experience.

提交回复
热议问题