Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

potentially dangerous Request.Form value was detected

Status
Not open for further replies.

mjd3000

Programmer
Apr 11, 2009
136
0
0
GB
I am posting XML to a webpage but I get the following error :

‘A potentially dangerous Request.Form value was detected from the client
(xml="<?xml version="1.0" ...").’

How do I prevent this error?
 
that would depend on how you are feeding the xml string to the page. if you are using an implementation of IHttpHandler or a generic handler (ashx) you would want to set the contenttype of the response to "text/xml".

if you are using a webform then you could try to Html.Encode() the string before rendering, although this may effect formatting and characters.

if you are just displaying xml without any other elements on the page I would use a generic handler (ashx) rather than a webform (aspx). you don't need the entire page life cycle to render text.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top