tags:

views:

559

answers:

2

I'm trying to configure IIS to parse a .xml file just like it would parse a .aspx file. The reason is I have some c# code in a <script> block that does scans some folders and then spits out dynamic xml.

Now normally I'd just do this in a .aspx file, and set the consuming code to grab the .aspx URL for the xml data. But, the consuming code is a legacy .swf file that is hardcoded to consume a .xml file of the same name, and we don't have access to the source .fla file.

I thought that this would be easy... but it's proving to be more difficult than I thought. I've gone into the application configuration in IIS and added the application extension for .xml to be the same as .aspx (Properties -> Home Directory tab -> Configuration), but it seems there's something I'm missing, as now trying to load the .xml file just does nothing, the browser comes back immediately with page can't be found.

Does anyone know how to get IIS and the .Net framework to parse my .xml file?

A: 

I think I redirect will be easier.

leppie
I thought of that too, but these .xml pages are going to be created by our customers, through a template based CMS. All the customer does is enter a few folder paths, and then publish the .xml file. Asking our customer to create the .aspx file and then the .xml file redirect isn't possible.
Jordan Hudson
You could setup redirection for all xml files in some directory.
leppie
+4  A: 

Once you add the configuration mapping in IIS, you also have to register the HttpHandler in your web.config (edit)as well as the build provider**(/edit)**:

<configuration><sytem.web>
    <httpHandlers>
        <add path="*.xml" verb="*" type="System.Web.UI.PageHandlerFactory" validate="true"/>
    </httpHandlers>
    <compilation>
       <buildProviders>
         <add extension=".xml" type="System.Web.Compilation.PageBuildProvider"/>
       </buildProviders>
    </compilation>
</sytem.web></configuration>
David
Now I get this: http://www.drumcafewest.com/media/photos/jordantest/gallery.xmlDid I lead us down the wrong path? The source of gallery.xml is available here: http://www.drumcafewest.com/media/photos/jordantest/gallery.txtI know the code works: just change txt to aspx. (they're all the same)
Jordan Hudson
I just edited the comment. Try adding the buildProvider code with what's above as well.
David
Beautiful! Thank you so much!
Jordan Hudson
i would vote up your answer but i don't have enough reputation yet.
Jordan Hudson