Help with IE bugs when writing JSON via an ASPX response
Posted
by Jereme
on Stack Overflow
See other posts from Stack Overflow
or by Jereme
Published on 2010-06-17T23:50:26Z
Indexed on
2010/06/17
23:53 UTC
Read the original article
Hit count: 219
I have an ASPX page that I am using to write JSON. It works great in Firefox and Chrome, but when I try and use it in IE 8 it gives me an "The XML page cannot be displayed" error instead of allowing jQuery to load the JSON being written by the response.
Any ideas?
Here is what my code looks like:
protected override void OnLoad(EventArgs e)
{
Response.Clear();
Response.ClearHeaders();
Response.ContentType = "application/json";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Write(string.Format("[ {{ \"Foo\": \"{0}\", \"bar\": \"{1}\" }} ]", "Foo Content", "Bar Content"));
Response.End();
}
© Stack Overflow or respective owner