It is required to write validations in both server and client side ? for example, if i use ajax controls as long as javascript are enabled on web browser it works fine therefore i do not need any server side validations but if the javascript disabled i myt
have to use server side . So what is the best practice ? doing both ?
Best practice is to validate the input @ both place.
- at the Client side which will help user to identity if he has entered wrong data, with error messages, highlights etc.
- at Server (@ Entity level OR @Page level - you have to decide the approach that suite to you) : this will ensure that your business logic is dealing with proper data.
Imagine the data is coming to you from multiple sources like Web Service Clients, Browsers etc. If you dont put validation in Server Side, you might end up with working on wrong data.
Somnath Mali
.NET Developer , Pune INDIA.
Please Mark As Answer If my reply helped you.
Marked as answer by roshan605 on Apr 26, 2012 05:24 AM
It's always better to validate inputs both at the client side and server side. Similarly while retrieving data from DB it's always a normal practise to chech IsDBNull at the server side so that unwanted runtime exceptions can be avoided.
Every good website should give the same user experience irrespective of Javascript enabled or disabled in the browser. So it's recommented to use validations at both client side and server side.
Marked as answer by roshan605 on Apr 26, 2012 05:24 AM
roshan605
Member
38 Points
26 Posts
Validation in web application
Apr 26, 2012 04:33 AM|LINK
It is required to write validations in both server and client side ? for example, if i use ajax controls as long as javascript are enabled on web browser it works fine therefore i do not need any server side validations but if the javascript disabled i myt have to use server side . So what is the best practice ? doing both ?
somnathmali
Contributor
2816 Points
450 Posts
Re: Validation in web application
Apr 26, 2012 04:55 AM|LINK
Best practice is to validate the input @ both place.
- at the Client side which will help user to identity if he has entered wrong data, with error messages, highlights etc.
- at Server (@ Entity level OR @Page level - you have to decide the approach that suite to you) : this will ensure that your business logic is dealing with proper data.
Imagine the data is coming to you from multiple sources like Web Service Clients, Browsers etc. If you dont put validation in Server Side, you might end up with working on wrong data.
.NET Developer , Pune INDIA.
Please Mark As Answer If my reply helped you.
nbsamurai
Member
592 Points
220 Posts
Re: Validation in web application
Apr 26, 2012 05:22 AM|LINK
It's always better to validate inputs both at the client side and server side. Similarly while retrieving data from DB it's always a normal practise to chech IsDBNull at the server side so that unwanted runtime exceptions can be avoided.
Every good website should give the same user experience irrespective of Javascript enabled or disabled in the browser. So it's recommented to use validations at both client side and server side.
roshan605
Member
38 Points
26 Posts
Re: Validation in web application
Apr 26, 2012 05:24 AM|LINK
Thanks