Need to serve index.htm as default document from subdirectory

Topics: General
Jun 27, 2011 at 11:36 PM

This is probably just a general IIS/MVC question, but I can't seem to figure how to do this with my Orchard site.

I created a subdirectory off the root of my site named Facebook which contains a simple index.htm file and an image. I copied the web.config file over from the Media directory, so now if I enter, the page comes up with the image displayed.

This page is being used as an application page within Facebook to provide information about the site. Facebook will only allow you to map to the directory, not the file. So I can only map to

The issue is that I can't seem to figure out how to get index.htm to come up as the default document for this subdirectory. I checked the IIS settings and index.htm is at the top of the list for default documents. I tried a couple of settings for the web.config file in this directory to manually declare a default document, but nothing seemed to work.

Does anyone have any suggestions on how to make this work so that I can get index.htm to display as the default document in a subdirectory in my Orchard site? Or if anyone else has created a Facebook application for their site, do you have another solution? Thanks!

Jun 27, 2011 at 11:54 PM

It would help if you would post your web.config. Did you try mapping the htm extension to the static file handler?

Jun 28, 2011 at 12:04 AM

The web.config from the /Facebook folder? It's the same one that's in the Media folder...

<?xml version="1.0" encoding="UTF-8"?>
    <add key="webpages:Enabled" value="false" />
      <!-- iis6 - for any request in this location, return via managed static file handler -->
      <add path="*" verb="*" type="System.Web.StaticFileHandler" />
    <handlers accessPolicy="Script,Read">
      iis7 - for any request to a file exists on disk, return it via native http module.
      accessPolicy 'Script' is to allow for a managed 404 page.
      <add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />

are you saying to add a line that looks like this?

      <add name="Htm" path="*.htm" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
Do I have that right? I'll give it a shot if that's correct...I had thought that path="*" would have allowed anything.

Jun 28, 2011 at 12:16 AM

No, that won't add anything. I think the problem here may be that the route is getting handled by something. Might want to explore that.

Jun 28, 2011 at 12:42 AM
Edited Jun 28, 2011 at 12:43 AM

The error being returned looks like a standard IIS 404 error


comes right up.

Could that still be a routing issue? If so, I'll look at that next. Thanks!

Jun 28, 2011 at 12:52 AM


Jul 1, 2011 at 5:42 PM

I couldn't seem to figure out what the problem is, but I found away around it. Since I have my own module serving up my application, I just created a route to a page within my module that is not themed so that I can customize it anyway I want. Works great and probably actually a better solution than serving up a static html file.

Thanks for the ideas.