views:

33

answers:

1

I suspect the answer is no (or at least, not in an intelligent manner), but felt like asking.

Is it possible in an asp.net HttpModule to determine the page that is going to be returned to the user, taking default page settings of IIS into account (without hardcoding them outside of IIS). For example, if a user requests http://www.example.org/bar/, the real page might be http://www.example.org/bar/index.html -- but could just as easily be http://www.example.org/bar/foot.html , depending on the user's IIS settings.

+1  A: 

You're correct: in cases where there was no file.ext available in the requested URL, the IIS settings would have to be available in order to determine the actual page that was returned.

Given that the module has to live on the IIS server, I think you could get the list of default pages configured in IIS by connecting via WMI. You'd then have to get the list of files in the requested folder to figure out which of the default pages was actually returned.

Dave Swersky
@Dave: Kind of obvious in hindsight. I think http://stackoverflow.com/questions/1039062/c-net-server-path-to-default-index-page is probably something like what I would need to do.
Brian