Checking IsValid in the web form

  • Thread starter Thread starter R.A.
  • Start date Start date
R

R.A.

Hi

If I use the client side validation control, do I need to check for IsValid
on the server side? if yes then why?


Thanks
 
Yes since you cannot be certain that client-side validation will be
executed. Some examples of when this might happen:

1. Client browser does not support the validation code.
2. Client browser has javascript disabled.
3. Post to the form comes from outside your application.

Any of these might be due to either "innocent" and valid client behaviour.
However, you should also be protecting yourself against malicious attempts
to hack your application, which can use any of the above mechanisms as well
in order to deliberately bypass client-side validation.

HTH,
Nicole
 
Definitely.
#1: There's no guarantee the client-side stuff wasn't bypassed or otherwise didn't work. It's
pretty trivial to get around Javascript validation if you want to; I've done it a number of times
myself simply because the page's validation code was broken but I needed to use the form anyways.
 
Yes. The validators are not polled until you call the Validate method. The
requirement to call Validate before IsValid is mentioned in the
documentation for the IsValid property.
 
Back
Top