c# - Error: A potentially dangerous Request.Form value was detected from the client -


i use ajax function send data server:

 function createbuffer() {         var xmlsel = parent.parent.mapframe.getselectionxml();         alert(xmlsel);         $.ajax({             type: "post",             url: '../../taskpanel/createbuffer',             data: { "session": '@viewbag.session', "mapname": '@viewbag.layout', "selection": xmlsel },             success: function (result) {                 parent.parent.zoomtoview(-87.708421, 43.745046, 7196.85673, true);             }         });     } 

using row in action method on server retrive xml:

   public void createbuffer()     {        string selectionxml = request.params["selection"];     } 

but in row:

 string selectionxml = request.params["selection"]; 

i error:

additional information: potentially dangerous request.form value detected client (selection="<?xml version="1.0" ..."). 

any idea why error above?

thank in advance!

the problem xml (selection parameter) triggering request being dangerous asp.net.

if you're on .net 4.0 or above, fix issue adding following web.config

<configuration>   <system.web>    <httpruntime requestvalidationmode="2.0" />   </system.web> </configuration> 

if you're on .net 2.0 however, you'll have add 1 config setting ends looking like:

<configuration>   <system.web>    <httpruntime requestvalidationmode="2.0" />   </system.web>   <pages validaterequest="false" /> </configuration> 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -