0

Hi I am developing a web app using asp.net mvc with knockout

I wanted to know if there is a way to use JavaScript to do server side validation or would it be best to use the model?

1 Answer 1

1

Javascript to do server validation? Hmm. What if javascript is disabled? Or even worse: what if someone intentionally disables javascript and sends to your server whatever garbage he likes?

The answer to your question is: no. Absolutely never rely on javascript to do validation. At minimum do validation on the server using whatever you like (Data Annotations or personally I prefer FluentValidation.NET). Client validation is a bonus. It allows for more responsive interfaces, improves user experience, reduces bandwidth usage, ... But exactly as bonuses, you can live without it. What you can't live without is the server side validation which is your main source of revenue.

Sign up to request clarification or add additional context in comments.

1 Comment

Cheers just a thought will have a look at fluent validation.net think will stick to client side validation using knockout very responsive

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.