views:

1336

answers:

1

I am converting a script from PHP to ASP.net C#. In PHP, i could use something like:

header('Content-type: text/json');

header('Content-type: application/json');

How can I tell my aspx page to declare in the header that it is printing a JSON file?

+10  A: 
Response.ContentType = "application/json";

or more generally

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