ViewXML in IE via  ASP

Posted on 2011-04-26
Last Modified: 2012-05-11
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>

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:

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

Question by:sidwelle
    LVL 82

    Accepted Solution

    Before you begin sending the content, set the contentType to xml:

    Open in new window


    Author Closing Comment

    That worked!

    What was the browser defaulting to if not "text" ?
    LVL 82

    Expert Comment

    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.

    Author Comment

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    This demonstration started out as a follow up to some recently posted questions on the subject of logging in: and…
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now