What’s the best way to validate controls, client-side JavaScript validation or server-side validation?
What’s the best way to validate controls, client-side JavaScript validation or server-side validation?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The .NET validators work both client side and server side.
This is best practice, as you want the responsiveness of the client side, but the security of the server side (as you should never trust the client – always validate on the server as well).
For example – with tools like firebug, javascript may be active, but the script can be easily tampered with (so it “passes” validation on the client, even if it shouldn’t). Your server side code is not exposed to the client, so you should always also validate on the server side.