473,394 Members | 1,718 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,394 software developers and data experts.

disabling ValidateRequest for one textbox

Hi,

I have one textbox on the form that needs to have ValidateRequest disabled,
but it seems that it can only be enabled/disabled at a page level.

assuming I have to disable it at for the whole page, how can I invoke
ValidateRequest functionality for the other text boxes individually? I was
looking for some kind of method on I can call that says "validate this
control as if ValidateRequest were true" or a function "would this string
pass ValidateRequest"

TIA

Andy
Nov 18 '05 #1
2 2984
Microsoft has not built a field-by-field capability into ValidateRequest. In
fact, their code for validation is not "public" (its an internal class). So
its simply not available.

I built a far more aggressive system to protect against Cross Site Scripting
and SQL Injection attacks that you may want to investigate. "Visual Input
Security" (http://www.peterblum.com/vise/home.aspx) provides validators that
can be assigned to individual controls and detect script attacks.

An example of being more aggressive: It lets you define a list of HTML tags
that you want to permit on a field and will still block those tags when
illegal javascript is also embedded in them.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Andy Fish" <aj****@blueyonder.co.uk> wrote in message
news:Oo**************@tk2msftngp13.phx.gbl...
Hi,

I have one textbox on the form that needs to have ValidateRequest
disabled, but it seems that it can only be enabled/disabled at a page
level.

assuming I have to disable it at for the whole page, how can I invoke
ValidateRequest functionality for the other text boxes individually? I was
looking for some kind of method on I can call that says "validate this
control as if ValidateRequest were true" or a function "would this string
pass ValidateRequest"

TIA

Andy

Nov 18 '05 #2
Thanks peter, I can't blame you for advertising your toolkit which I'm sure
is excellent, but I found a simple way to invoke the microsoft request
validation: details below for anyone who has the same problem.

download Lutz Roeder's reflector and decompile the class
System.Web.CrossSiteScriptingValidation, then past the code into your own
class. Then you can call IsDangerousString on any text field you want to
validate. I was going to post the source here but that might mean some
people would miss out on using this fantastic tool.

Some caveats for anyone who wants to do it this way:

1. you must remove null characters from the string before calling the
validation, otherwise you could fall foul of a known IE vulnerability (see
the source for HttpRequest.ValidateString).

2. if a new version of the framework comes out with improvements to the
validation, you'll need to recreate your class

3. decompiling and reusing the source might contravene your licence
agreement for using the framework (IANAL)

Andy

"Peter Blum" <PL****@Blum.info> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Microsoft has not built a field-by-field capability into ValidateRequest.
In fact, their code for validation is not "public" (its an internal
class). So its simply not available.

I built a far more aggressive system to protect against Cross Site
Scripting and SQL Injection attacks that you may want to investigate.
"Visual Input Security" (http://www.peterblum.com/vise/home.aspx) provides
validators that can be assigned to individual controls and detect script
attacks.

An example of being more aggressive: It lets you define a list of HTML
tags that you want to permit on a field and will still block those tags
when illegal javascript is also embedded in them.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Andy Fish" <aj****@blueyonder.co.uk> wrote in message
news:Oo**************@tk2msftngp13.phx.gbl...
Hi,

I have one textbox on the form that needs to have ValidateRequest
disabled, but it seems that it can only be enabled/disabled at a page
level.

assuming I have to disable it at for the whole page, how can I invoke
ValidateRequest functionality for the other text boxes individually? I
was looking for some kind of method on I can call that says "validate
this control as if ValidateRequest were true" or a function "would this
string pass ValidateRequest"

TIA

Andy


Nov 18 '05 #3

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

Similar topics

1
by: Shaun Dore | last post by:
Hi, I have a web form containing a TextBox that allows users to edit XML files. When the page is posted, the changes are saved. This worked fine until the ValidateRequest 'feature' came along in...
2
by: Tim Zych | last post by:
I'm trying to stop .Net from validating data entered into a textbox. When I enter < or > .Net returns an error: potentially dangerous Request.Form value was detected from the client... so a...
3
by: Umut Tezduyar | last post by:
I couln't find the code begind property on the Page object that represents the "ValidateRequest" attribute on the @Page element. There must be some property that the PageParser knows what to do...
0
by: aualias | last post by:
I have a TextBox that the user can enter html code into. I cannot send the entered text to the server without setting ValidateRequest to false. Is there a way that I can HtmlEncode() on the fly,...
2
by: Ben R. | last post by:
Is there any way to selectively have ValidateRequest on based on the logged in user? Also, can we control what tags will be allowed? For example, I don't have a problem with my users toggling...
2
by: \A_Michigan_User\ | last post by:
*WITHOUT* using: ValidateRequest="False" for the whole page (or my whole site).... How would I trap/detect that a textBox contains some illegal characters? (I'm using asp.net v1.1 and vb.net)...
0
by: \A_Michigan_User\ | last post by:
I guess I'm not understanding this correctly. I have to set "ValidateRequest=False" for my asp.net 1.1 page that has a TextBox... so that I can avoid an error... if some user enters some html or...
3
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I get an error on a .net 2.0 page when I use foreign characters, such as ç or ã. Setting validateRequest=false handles this, but is there a way to keep validateRequest=true but allow foreign...
2
by: msch.prv | last post by:
Is there a specific method to disable field validators in a user control.from within a parent page or does it require an ad hoc approach? The page attribute ValidateRequest does not seem to be...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.