keyongtech


  keyongtech > dotnet.framework.aspnet.* > dotnet.framework.aspnet.main > 07/2007

 #1  
07-25-07, 02:04 PM
Victor
Hi guys
I have a question regarding to how to do the request validation on user's
input. We all know in asp.net. when user input something like <a>blah
blah</a> by default, It will throw a HttpRequestValidationException say "A
potentially dangerous Request.Form value was detected from the client ". And
This validation can be turned off in the page.

Now, I am quite annoy about all these exceptions cause by someone want to
post some kinds of the ads on my website. And I really do not to disable the
page request validation. The best the result for me will be I can do
something about it before it reach the request validation event, like check
the user input myself then redirect to some other pages. if user continue
doing that, the system will automatically lock user's account, and send to
an email to admin.

Is there anyway I can achieve this? Or do you have better ideas? Any help
will be appreciate?
Thanks a lot
Cheers
Victor
 #2  
07-25-07, 02:30 PM
Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
I suggest you disable the page request validation and instead use
Microsoft's free Anti-Cross Site Scripting Library.
http://msdn.microsoft.com/en-us/security/aa973814.aspx

If that doesn't work out for you, use a White List approach to specify only
which characters are allowed - and deny all other characters.
 #3  
07-26-07, 02:45 AM
Walter Wang [MSFT]
Hi Victor,

I agree with Steve here, with the Anti-Cross Site Scripting Library and
turning off "validateRequest", you should be able to accept any input
without vulnerable to marlicious script:

Literal1.Text =
"Hello " + Microsoft.Security.Application.AntiXss.HtmlEncode( TextBox1.Text)
+ "! Welcome to the examples!";

Regards,
Walter Wang (wawang, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 #4  
07-31-07, 02:58 AM
Victor
Hi Steve and Walter:
Thanks for your help. This is really a good clue for me to solve my problem.
I am still doing research on the AntiXss class. Hopefully, I can start use
that soon..
cheers thans again for the help.

Victor

"Walter Wang [MSFT]" <wawang> wrote in message
news:5836
[..]
Similar Threads
Redirecting Request Validation?

Is there any way to redirect the output from Request Validation to an actual page of our choosing?

Request Validation.

Can anyone tell me what is potentially dangerous with the following combination of letters "OnU="

Request Validation

Hi, can i disable RequestValidation per request somehow? regards henrik

Request Validation

Hi, I've a simple web form (webform1.aspx) with a text box & button. The click event of the button appends the value of the text box to the URL and redirects...

Logon Request Validation

I have a problem with a Win2000 Small Business Server running Active Directory that I cannot resolve. I have tried KB searches for info regarding this problem and...


All times are GMT. The time now is 07:09 AM. | Privacy Policy