I spent a considerable portion of my morning yesterday trying to get my classic ASP to serve up JSON to an application I’m working on. Finally, I found a subtle difference in the “Response.ContentType” property and “Response.AddHeader()” method (I code in JavaScript, btw). I set “Response.ContentType = ‘application/json’” and it always returned a nicely-formatted JSON object, but the response header wasn’t sending it as json. Finally, I used “Response.AddHeader(‘Content-Type’, ‘application/json’)” and it sent the response as json (though the textual representation in my Chrome window wasn’t formatted nicely like before). The only difference I could find was that “Response.ContentType” returned a header with “Content-type” (notice the lowercase “t” in “type”), whereas “Response.AddHeader()” returned a header with the appropriate “Content-Type” property. Odd. Maybe it was just me, but it’s working now.

So, in sum, use the following when returning a JSON object in classic ASP:

"Response.AddHeader('Content-Type', 'application/json')"

instead of “Response.ContentType”.  This applies to any other MIME type you’re sending, I guess.