all groups > inetserver asp general > july 2007 >
You're in the

inetserver asp general

group:

XML Content Type


XML Content Type Jim
7/27/2007 7:22:02 AM
inetserver asp general:
Does anyone know why Response.AddHeader "Refresh" does not work when
Response.ContentType = "text/xml"?

The code is very short:
<%
Response.ContentType = "text/xml"
Response.AddHeader "Refresh", "5;URL=http://localhost/ReturnXML2.asp"
%>
<CiscoIPPhoneImage>
<LocationX>-1</LocationX>
<LocationY>-1</LocationY>
<Width>125</Width>
<Height>23</Height>
<Data>Hex GUID goes here</Data>
<Title>The XYZ Company</Title>
</CiscoIPPhoneImage>

If I change the contentType to "text/plain", the page does refresh/redirect
but not when the ContentType is XML. It needs to be in XML for Cisco Call
Manager.

There is documentation out there that makes it seem like executing the above
code is no problem but I can't get it to refresh/redirect. Can anyone shed
any light?
Re: XML Content Type Anthony Jones
7/27/2007 3:52:47 PM
[quoted text, click to view]

The refresh header is a directive to the HTML browser (that browsers aren't
obligated to implement) it isn't a header defined by the HTTP protocol.
When using text/plain the browser assumes responsibility for rendering the
content (IE treats it as HTML). Since the content it is rendering has a
refresh header attached it puts it into action.

However when the content is text/xml the browser isn't actually rendering
the XML. It uses the <?xml-stylesheet processing instruction in the xml
document to transform the XML to content it should render. If that PI isn't
present is uses a default transform. After the transform the content it is
actually rendering no long has a refresh header associated with it so
nothing happens.

Cisco call manager that consumes your XML content would have to be coded to
honor the refresh header.

--
Anthony Jones - MVP ASP/ASP.NET

AddThis Social Bookmark Button