Creating a JSON Header on ASP.NET Creating a JSON Header on ASP.NET asp.net asp.net

Creating a JSON Header on ASP.NET


Response.ContentType = "application/json";

or more generally

Response.Headers.Add("Content-type", "text/json");Response.Headers.Add("Content-type", "application/json");


Additional info about JerSchneid's answer

If you got an error message like this:

This operation requires IIS integrated pipeline mode.

You can use this way:

Response.AddHeader("Content-type", "text/json");