473,387 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Validator Controls

Since validator controls use client side javascript to validate the input.
Do I still need to validate user input at the server side?
What if an attacker writes a custom script that doesn't require the use of
an internet browser? Will he be able to skip the asp.net validator controls?

Thanks,
Howard
Jun 3 '06 #1
2 1390
Validators use JavaScript when it is available, but keep in mind that users
can disable JavaScript. To make sure this does not prevent the Validators
from validating the submitted data, validation is performed server-side as
well. Why bother to create the code in both places, you ask? Well, because
when JavaScript is enabled, the server-side validation will not be executed
until the data is valid (except in the case of a CustomValidator). This
means less trips between the client and server. As for your question as to
whether you still need to validate user input at the server side, the answer
is the boring "It depends". What does it depend on? Well, it depends on what
you are validating and what validators you have. The key questions to ask
yourself are:

1. What do I know about the input I am recieving now that it has passed the
test of my validators?
2. What requirements do I need the input to meet in order to be valid?
3. Do I know for sure that the input meets these requirements?
4. What, if any, extra validation do I need to do to the input in order to
be sure it meets these requirements?

Normally, the answer to #4 will be performed in a CustomValidator so that
the error message can be displayed in a friendlier manner if the user needs
to see it and so that you can determine whether the data is valid by using
the Page.IsValid property. As far as the part about attackers, well, I'm not
an expert in that area, so all I can say is validate all input as strictly
as possible (without making the page unattractive to users, of course), make
sure the error message tells the user what is wrong with their input, and,
of course, use all the network safety features on your network, because an
attacker can't run their custom script if they can't get to your network.
Hopefully this information is helpful, and for more details, you might want
to post to one of the security or network newsgroups. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Howard" <ho*******@yahoo.com> wrote in message
news:uA**************@TK2MSFTNGP05.phx.gbl...
Since validator controls use client side javascript to validate the input.
Do I still need to validate user input at the server side?
What if an attacker writes a custom script that doesn't require the use of
an internet browser? Will he be able to skip the asp.net validator
controls?

Thanks,
Howard

Jun 3 '06 #2
Thanks.
This is very helpful

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:ut*************@TK2MSFTNGP05.phx.gbl...
Validators use JavaScript when it is available, but keep in mind that
users can disable JavaScript. To make sure this does not prevent the
Validators from validating the submitted data, validation is performed
server-side as well. Why bother to create the code in both places, you
ask? Well, because when JavaScript is enabled, the server-side validation
will not be executed until the data is valid (except in the case of a
CustomValidator). This means less trips between the client and server. As
for your question as to whether you still need to validate user input at
the server side, the answer is the boring "It depends". What does it
depend on? Well, it depends on what you are validating and what validators
you have. The key questions to ask yourself are:

1. What do I know about the input I am recieving now that it has passed
the test of my validators?
2. What requirements do I need the input to meet in order to be valid?
3. Do I know for sure that the input meets these requirements?
4. What, if any, extra validation do I need to do to the input in order to
be sure it meets these requirements?

Normally, the answer to #4 will be performed in a CustomValidator so that
the error message can be displayed in a friendlier manner if the user
needs to see it and so that you can determine whether the data is valid by
using the Page.IsValid property. As far as the part about attackers, well,
I'm not an expert in that area, so all I can say is validate all input as
strictly as possible (without making the page unattractive to users, of
course), make sure the error message tells the user what is wrong with
their input, and, of course, use all the network safety features on your
network, because an attacker can't run their custom script if they can't
get to your network. Hopefully this information is helpful, and for more
details, you might want to post to one of the security or network
newsgroups. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Howard" <ho*******@yahoo.com> wrote in message
news:uA**************@TK2MSFTNGP05.phx.gbl...
Since validator controls use client side javascript to validate the
input. Do I still need to validate user input at the server side?
What if an attacker writes a custom script that doesn't require the use
of an internet browser? Will he be able to skip the asp.net validator
controls?

Thanks,
Howard


Jun 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Antonio Maciel | last post by:
Hi. I tried the asp.net newsgroup before but with no success. I have some asp.net validator controls on the pages of a site. In IE the controls work ok but when I run the site on Netscape 7...
0
by: Antonio Maciel | last post by:
Hi. I have two usercontrols on the same page. The first control is a login control, with two textboxes, one button and some validator controls for the textboxes. The second control is a 'search...
2
by: Dune | last post by:
Hi there, If a control is disabled (enabled = false), will the validator controls associated with it automatically know not to carry out validation? I have a page with a bunch of controls and...
1
by: John Holmes | last post by:
I'm using the RequiredFieldValidator on 9 text boxes and then a Validation Summary control for bringing up a message when the user tries to click a button that makes a trip to the server. This...
2
by: Bobby Maul | last post by:
I'm not sure the subject of this post adequately describes my situation, so let my elaborate. We have a web form with two textboxes--one for a start date/time and the other for an end date/time. ...
1
by: Simon Harvey | last post by:
Hi, Does anyone know if the validator controls work with Safari and other Non IE browsers? I have a number of required field validators and a summary control and when using safari, the...
2
by: BillGatesFan | last post by:
I have asp.net validator controls on a page in an IFRAME. How can I keep the page from submitting if the page in the iframe has validation errors. I can call a function in the child page from the...
3
by: danny.rendle | last post by:
I am attempting to create a web site using ASP.NET v1.1 to comply with the W3C's WAI Triple-A standard. To this end I need ASP.NET to emit valid HTML 4.01 Transitional (once confident with...
1
by: Maciek | last post by:
Hi all, I'm desinging a web page and I'm novice in this matters, so I need your help. I need to validate if checkbox is checked and to show an alert if it isn't. So I've added two Paul's...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.