Is server validation better than javascript?

Is server validation better than javascript? Do they limit us, because we can only use the functions that are provided to them. Please help me with this. I read about validation server controls on my own blog

+3
source share
4 answers

In general, you should always do server-side data validation. This ensures that you protect your server from malicious fake requests, you store data from entering invalid data (since db does not care about this). If you like to use a tool or framework to check input on the server side, as described in the article related to you, it is up to you.

Client-side validation, such as javascript, is also useful, but for a different reason: it allows you to provide useful information to the user before sending data.

So this is not a question of either. In fact, you are not doing double work here. The client-side and server-side checks simply serve a different purpose (accordingly, it increases usability for the user and protects the logic and security of your service).

, - (, , ). ( + JavaScript - ).

, , . (, , , , .) , , , , javascript javascript , - greasemonkey script.

+5

, :

  • . .
  • , , . , , .

, - "" , , , , . ASP.NET , . docs BaseValidator:

. script - (, Microsoft Internet Explorer 4.0 ) . , . , , .

+8

JavaScript, . , .

0

ASP, , , ValidationServerControls , , . (, ). , , ; javascript . javascript , .., , ; /sql.

JavaScript-; .

An ideal approach would be to have 1. Validating data in javascript; so server requests are limited in case of incorrect data entry. 2. Server side validation. in case javascript is disabled and the mailbox is sent to the server.

0
source

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


All Articles