client-side scripting or server-side scripting

I want to perform data validation in my page using javascript before
the data is sent to my server, but I am very confuse that I don't know
which way to perform, client-side validation or server-side validation?
My javascript bible told me that javascript is a client-side scripting
for data validation in client pc, but when I look in my bible,
the validation part is done at server side.

The worst is that, I find no way to use javascript in .asp or .aspx environment.

I am really confuse with all these, could any one help me on this? Thanks.

7/26/2005 5:40:37 PM
๐Ÿ“ƒ 24353 articles.
โญ 1 followers.

๐Ÿ’ฌ 5 Replies
๐Ÿ‘๏ธโ€๐Ÿ—จ๏ธ 996 Views

Use .NET validator controls to do your validation.

Eric | Twitter epascarello | LinkedIn
7/26/2005 5:51:40 PM

I agree with alien51 ...
validation is usually performed client side. even when you use the validation controls of .netย the validation is performed on the client. unless you have to compare a value with a database value... always use client side script...
see my blog at and check the future of open mobile widget solutions at
7/27/2005 11:13:59 AM
In general we have to prefer client side validation because it will reduce the number of trips to server.
But some browsers may not support java script(or the user may desable java script on browser)
So even if you done client side validation you need to write server side validation also.

Inster of these problems you can user the validation controls provided with .Net
The main advantage of these controls is they will check the brower whether it allow client side script or not
if yes they will do client side validation. Else they perform server side validation which is a automatic

Finally your validation include any database related value comparison you need to implement this with
server side validation only.


Krishna Kishore.ย ย View My Blog
7/27/2005 11:41:41 AM
In fact, I used to develop web page in .aspx and I use C# as
server-side scripting. Also, I did used the validator provided by the
..NET framework, but I don't like the validation control because it is not that
impressive (may be there is some other good validation control that is
out of my knowledge, but the validation control that I used before was not that good). Instead of
having the validation control's error message shown in the manner
much similar to a label, I would like the error message to be shown
using alert box, or any other boxes as for different purposes. By using
the pop-up box, it looks cool, don't you all feel that?

I agree with csharppointer, where I prefer to have client side validation to free the server from out of resources. This is why I want to use client side scripting for validation, especially javascript. The only thing is that I don't know when to perform server side validation and when to perform client side validation.

Finally your validation include any database related value comparison you need to implement this with
server side validation only.

csharppointer, is it possible for me to validate my page data using javascript then only pass it to other .aspx page for data processing (e.g. compare with DB data)? For example, first I validate the data in purchase.html at client side, and once it is validated, the data validated then is to be passed to process.aspx page for further data processing (e.g. insert into database table).
7/27/2005 2:19:08 PM
Since you are unaware of other validation solutions, let me point out the one I've written: Professional Validation And More. It handles more browsers and have many ways to get the users attention, including alerts, changing the color of the field with the error or the label for that field, and even blinking the error message.

No matter what, you must always write code to validate on the server side everything that you validated on the client-side. This point has been made in this thread but its essential. You see, hackers and people who turn off javascript on their browser will bypass your client-side validation leaving your server side code vulnerable to invalid (and inappropriate) data.

In both Microsoft's and my Validation systems, the submit buttons automatically fire the server side validation on every validator for you. You have only one task: before saving your data, test that the page is valid:
If Page.IsValid Then
ย  ' save
You do this inside the Click post back event handler.

If you want to submit one page and then move to another, understand that ASP.NET always posts back to the original page. That way, the web control objects can process the data. You can move to another page after all of the processing is done using either Responce.Redirect or Server.Transfer. (Both are documented in the .net documentation.) Server.Transfer is better for passing along the values from one page to the next.
--- Peter Blum
Creator of Peter's Data Entry Suite (formerly Professional Validation And More and Peter's Date Package) and Peter's Polling Package
7/27/2005 4:10:40 PM