Passing HTML via HttpRequest

I have an HTML page that makes an HttpRequest to an ASP page that I currently have setup to simply return true.

If the data is simple text (letter-body) it passes fine:

  • Request Method:
    POST
  • Status Code:

    200 OK
  • Request Headers
    [LIST]
  • Accept:
    /
  • Accept-Encoding:
    gzip,deflate,sdch
  • Accept-Language:
    en-US,en;q=0.8
  • Connection:
    keep-alive
  • Content-Length:
    181
  • Content-Type:
    application/x-www-form-urlencoded
  • User-Agent:
    Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36
    [/LIST]
  • Form Data
    [LIST]
  • letter-body:
    Testing some plain text.
    [/LIST]

But as soon as I add any HTML to the letter-body value it fails:

  • Request Method:
    POST
  • Status Code:

    500 Internal Server Error
  • Request Headers
    [LIST]
  • Accept:
    /
  • Accept-Encoding:
    gzip,deflate,sdch
  • Accept-Language:
    en-US,en;q=0.8
  • Connection:
    keep-alive
  • Content-Length:
    196
  • Content-Type:
    application/x-www-form-urlencoded
  • User-Agent:
    Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36
    [/LIST]
  • Form Data
    [LIST]
  • letter-body:
    Testing some <b>HTML</b>.
    [/LIST]

I’m also encoding the letter-body string with encodeURIComponent() though it’s showing it as decoded when I look at the headers.

Any ideas? Thanks!

From the JavaScript side of things, everything seemed to work. The request went out with the data you expected. That the server responded with an internal error means the ASP code didn’t like the content you sent. You’ll have to investigate the ASP side of things to find out why.

Just did. Seems there’s a default setting on ASP to not allow code to be passed unless you change validateRequest = false.

Thanks!