I suspect this is an IE setting problem, but I can't seem to figure out what is set wrong. Anyhow I have an .ashx file that produces javascript functions. It works fine when linked up using the [script src=""] method but when I want to debug it like look
at it directly. When I point IE at the URL directly instead of getting the javascript on the page I get this error message:
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the
Refresh button, or try again later.
Invalid at the top level of the document. Error processing resource 'http://localhost:4621/WebDoE/Scripts/ReagentProperties...
// javascript function for dealing with reagent properties ^
And for reference the first two lines of the ProcessRequest method are:
context.Response.ContentType = "text/plain";
context.Response.Write("// javascript function for dealing with reagent properties\r\n\r\n");
If anyone has a clue why IE would thinks an .ashx file should be xml even when the content-type is "text/plain" I'd appeciate it. Thanks.
From what I found, this is a security setting in IE protecting the user from active content sent by a server claiming it to be "plain". See the document below. Serch it for the phrase "Why is this change important?"
AgnosticOrac...
Member
85 Points
18 Posts
.ashx - The XML page cannot be displayed
Apr 20, 2006 02:28 PM|LINK
If anyone has a clue why IE would thinks an .ashx file should be xml even when the content-type is "text/plain" I'd appeciate it. Thanks.
WolfeMan
Member
50 Points
10 Posts
Re: .ashx - The XML page cannot be displayed
Apr 20, 2006 06:51 PM|LINK
Hello AgnosticOracle,
From what I found, this is a security setting in IE protecting the user from active content sent by a server claiming it to be "plain". See the document below. Serch it for the phrase "Why is this change important?"
http://www.microsoft.com/technet/prodtechnol/winxppro/maintain/sp2brows.mspx#ECVBG
Joel Stevick
Member
5 Points
1 Post
Re: .ashx - The XML page cannot be displayed
Jul 11, 2006 10:33 AM|LINK
I was able to resolve this problem by explicitly setting the content type in the response header:
context.Response.Buffer = true;
context.Response.Clear();
context.Response.ContentType = "text/plain";
context.Response.AddHeader("Content-Disposition", "attachment; filename=\"agenda.js\";");
context.Response.AddHeader("Content-Length", response.Length.ToString());
context.Response.Write(response);
I hope this helps
Joel