[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 307
  • Last Modified:

ViewXML in IE via ASP

I have an XML file that is retrieved via ASP.  If I view the file directly by opening the file with IE, the file looks as you would expect:
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <update>
  <tag1>TagData1</tag1>
  <tag2>TagData2</tag2>
</update>

But, If the file is retrieved and displayed from an ASP page, all tags are hidden and all the text data is displayed as single long line:
TagData1TagData2

Its like IE is displaying the file based on what type of file was retrieved from, not what it retrieved ?


0
sidwelle
Asked:
sidwelle
  • 2
  • 2
1 Solution
 
hieloCommented:
Before you begin sending the content, set the contentType to xml:
<%
Response.ContentType="text/xml"
...
%>

Open in new window

0
 
sidwelleAuthor Commented:
That worked!

What was the browser defaulting to if not "text" ?
0
 
hieloCommented:
web servers typically have a "lookup" table that maps file extensions to mime types. Ex - hello.html or hello.htm will cause the server to send "text/html".  Typically, if an extension is NOT located in that "lookup table", it will use the "default" mime type configured on that server. Typically, this default mime type can be configured/changed to whatever you want. So the correct answer to

>>'What was the browser defaulting to if not "text" ?'
is whatever is configured on your server.  Typically, it would be either text/html OR text/plain.

>>'Based on "all tags are hidden and all the text data is displayed as single long line:'
My guess is it is configured to text/html.
0
 
sidwelleAuthor Commented:
That setting must be internal to the version of IIS that I have (5.1). The mime list that is configurable is empty.

Thanks for the help.

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now