Sending XML data via HTTP POST to IHttpHandler causes HttpRequestValidationException

前端 未结 2 1541
攒了一身酷
攒了一身酷 2021-01-22 12:53

I\'m writing an IHttpHandler implementation that will receive XML data sent through a regular HTTP POST from another website. Here\'s a prototype of the implementation:

相关标签:
2条回答
  • 2021-01-22 13:13

    Just modify the web.config like this:

       <location path="Handlers/MyHandler.ashx">
          <system.web>
             <httpRuntime requestValidationMode="2.0" />
          </system.web>
       </location>
    
    0 讨论(0)
  • 2021-01-22 13:19

    As far as I know, you just need to encode that XML with entities.

    I mean that < should be & lt; or > & gt;, and so on.

    EDIT: I found that this is a duplicate of: How can Request Validation be disabled for HttpHandlers?

    Try this!! :)

    0 讨论(0)
提交回复
热议问题