473,387 Members | 1,549 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.

Trapping a ' potentially dangerous Request.QueryString value'

I am attempting to use a try/catch block to trap a querystring which
is caught by ValidateRequest="true" in the @page directive

A simple example of the blockthat does not work is

Try
routeID = Request.QueryString("routeID")
Catch
response.Write("a dangerous query string has been entered")
End Try

when I enter an invalid query string I get an error message in
the browser window as follows:

"A potentially dangerous Request.QueryString value was detected from
the client (routeID="<script>alert('boo')..."). "

However nothing is caught by the Try /Catch block and the page does
not get rendered at all ( buffer currently set to false)

My ultimate objectiveI is to trap this error so that I can redirect to
another page.

Any help on how I can trap this invalid querystring would be
appreciated,

Best wishes,
John Morgan
Nov 18 '05 #1
1 5844

Put your try/catch block into the appropriate method inside Global.asax

-Oleg.
"John Morgan" <jf*@XXwoodlander.co.uk> wrote in message
news:rq********************************@4ax.com...
I am attempting to use a try/catch block to trap a querystring which
is caught by ValidateRequest="true" in the @page directive

A simple example of the blockthat does not work is

Try
routeID = Request.QueryString("routeID")
Catch
response.Write("a dangerous query string has been entered")
End Try

when I enter an invalid query string I get an error message in
the browser window as follows:

"A potentially dangerous Request.QueryString value was detected from
the client (routeID="<script>alert('boo')..."). "

However nothing is caught by the Try /Catch block and the page does
not get rendered at all ( buffer currently set to false)

My ultimate objectiveI is to trap this error so that I can redirect to
another page.

Any help on how I can trap this invalid querystring would be
appreciated,

Best wishes,
John Morgan

Nov 18 '05 #2

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

Similar topics

2
by: Anil Kripalani | last post by:
When a user of our ASP.NET 1.1 application submits a form with the phrase 'manuscript:' in a text field, ASP returns the error 'A potentially dangerous Request.Form value was detected from the...
5
by: Boris | last post by:
All, When i use .net FRamework 1.1, for my web application, i get an error saying "A potentially dangerous querystring was detected from the client...." I have read the posts related to this and...
1
by: angus | last post by:
Dear All, how to try-catch "A potentially dangerous Request.Form value was detected from the client (txtUserName="<asdf")." this exception? i've set the debugger in the Page_InIt function,...
6
by: Hardy Wang | last post by:
Hi, I put following value in my query string, then I got this error fx=hssGdNlaWq6f893_E3AcEHaT9spLQoTEudddVM3nUdMo6pjOvzqS6x9fRHvkZCYzg4Win6qxSVaV*iMtZgcgaSsV8EhgU3UJD6RKCg0l6uk8ic8oNhuJKw== I...
1
by: veenakj | last post by:
Hi Code snippet -------------- strErrMsg = "Could not find a part of the path \"C:\\Temp\\data\\Test.xml\"." } Server.Transfer("Message.aspx?errormsg=" + Server.UrlEncode(lsErrMsg));...
1
by: Sergey Zuyev | last post by:
Hello all I have simple edit form. When user saves data that contains restricted characters such as (< , etc.) , regular expression validator will display a warning message. It all works fine,...
2
by: arun | last post by:
Hi I want to store the text from a TextBox that contains <br, *, $ etc.to sql server. But it shows me an error message "A potentially dangerous Request.Form value was detected from the client...
1
by: djmc | last post by:
Using the asp.net button control (and I assume others), I place the phrase "Don't Save" in the .Text field. The button displays without any problems, but upon postback, the server responds with "A...
2
by: Steve Richter | last post by:
getting this "potentially dangerous Request.Form value was detected" exception with a textbox which I have populated with some source code. I think I am getting the exception when I click OK on...
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: 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:
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
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
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.