.ashx - The XML page cannot be displayedhttp://forums.asp.net/t/983702.aspx/1?+ashx+The+XML+page+cannot+be+displayedTue, 11 Jul 2006 10:33:44 -04009837021263180http://forums.asp.net/p/983702/1263180.aspx/1?+ashx+The+XML+page+cannot+be+displayed.ashx - The XML page cannot be displayed I suspect this is an IE setting problem, but I can't seem to figure out what is set wrong.&nbsp; Anyhow I have an .ashx file that produces javascript functions.&nbsp; It works fine when linked up using the [script src=&quot;&quot;] method but when I want to debug it like look at it directly.&nbsp; When I point IE at the URL directly instead of getting the javascript on the page I get this error message:<br> <blockquote> <p>The XML page cannot be displayed </p> <p style="font-family:verdana; font-style:normal; font-variant:normal; font-weight:normal; font-size:8pt; line-height:11pt"> Cannot view XML input using style sheet. Please correct the error and then click the <a target="_self" href="">Refresh</a> button, or try again later. </p> <hr> <p style="font-family:verdana; font-style:normal; font-variant:normal; font-weight:bold; font-size:8pt; line-height:11pt"> Invalid at the top level of the document. Error processing resource 'http://localhost:4621/WebDoE/Scripts/ReagentProperties...</p> <pre style="font-weight:normal; font-size:10pt; line-height:12pt; font-style:normal; font-variant:normal"><font color="blue">// javascript function for dealing with reagent properties<br>^<br></font></pre> </blockquote> <pre style="font-weight:normal; font-size:10pt; line-height:12pt; font-style:normal; font-variant:normal">And for reference the first two lines of the ProcessRequest method are:<br></pre> <blockquote>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; context.Response.ContentType = &quot;text/plain&quot;;<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; context.Response.Write(&quot;// javascript function for dealing with reagent properties\r\n\r\n&quot;);<br> </blockquote> If anyone has a clue why IE would thinks an .ashx file should be xml even when the content-type is &quot;text/plain&quot; I'd appeciate it.&nbsp; Thanks.<br> &nbsp; 2006-04-20T14:28:28-04:001263544http://forums.asp.net/p/983702/1263544.aspx/1?Re+ashx+The+XML+page+cannot+be+displayedRe: .ashx - The XML page cannot be displayed <p><font face="Arial">Hello AgnosticOracle,</font></p> <p><font face="Arial">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 &quot;plain&quot;.&nbsp; See the document below.&nbsp; Serch it for the phrase &quot;Why is this change important?&quot;</font></p> <p><font face="Arial"><a href="http://www.microsoft.com/technet/prodtechnol/winxppro/maintain/sp2brows.mspx#ECVBG">http://www.microsoft.com/technet/prodtechnol/winxppro/maintain/sp2brows.mspx#ECVBG</a></font></p> <p><font face="Arial"></font>&nbsp;</p> 2006-04-20T18:51:45-04:001337777http://forums.asp.net/p/983702/1337777.aspx/1?Re+ashx+The+XML+page+cannot+be+displayedRe: .ashx - The XML page cannot be displayed <p>I was able to resolve this problem by explicitly setting the content type in the response header:</p> <p>context.Response.Buffer = true;</p> <p>context.Response.Clear();</p> <p>context.Response.ContentType = &quot;text/plain&quot;;</p> <p>context.Response.AddHeader(&quot;Content-Disposition&quot;, &quot;attachment; filename=\&quot;agenda.js\&quot;;&quot;);</p> <p>context.Response.AddHeader(&quot;Content-Length&quot;, response.Length.ToString());</p> <p>context.Response.Write(response);</p> <p>&nbsp;</p> <p>I hope this helps</p> <p>Joel<br> </p> <font size="2"> <p>&nbsp;</p> </font> 2006-07-11T10:33:44-04:00