XML : MVC allow users to view xml instead of downloading

I have a dump of xml files in /Content/MyXML/ that I want users to be able to view when they click on a link to the xml file.

Currently if I click the link or access the URL directly, it pops up as a download in the browser, rather than just viewing it.

In the /Content/MyXML/ folder I have placed this web.config (otherwise I just got 404 errors when trying to access the xml files)

  <system.webServer>      <handlers accessPolicy="Script, Read">          <clear />          <add path="*.xml" verb="GET" type="System.Web.StaticFileHandler" name="xml allow" />          <add path="*.xml.gz" verb="GET" type="System.Web.StaticFileHandler" name="xml gz allow" />      </handlers>  </system.webServer>    

Is there anything I can add to the web.config to make browsers view the xml instead of downloading it?

No comments:

Post a Comment