Click here to Skip to main content
15,914,447 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Friends,

I have seen most of peolpe using C# validation instead of javascript.
Can any one educate me on this. Why C# is prefered more or is javascript much more enough.

Regards,
AP
Posted

1 solution

IMHO, Server side validation i.e. C# validation is a must have. But along with these the javascript validations should also be used.

most of the casual users use the web sites and for them the javascript validation will work. the benefit of having this in place is faster user response. the delay due to post-back is avoided and the user gets immediate feedback.

it is only when some user either is using the site with javascript turned of or someone is deliberately trying to bypass the javascript when server side validations in C# will be executed.

Having javascript validation is ensuring better response and usability of website where as having C# validations is ensuring security too. so we can say that.

1. Javascript validation is optional but C# validation is not.
2. We should try to use javascript validation whenever we can along with C# one as this will increase usability and decrease server load.
 
Share this answer
 
Comments
Arunprasath Natarajan 5-Jun-12 1:23am    
Well Explained Thank You.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900