Short of that, I guess that what's left to you is using ISAPI filters...
In between 'standard' remapping in the web.config and ISAPI it's also
possible to do this nicely using a custom error page. I was recently
working on a site doing something similar to the OP's original
requirements. Because it was shared hosting we could not install an
ISAPI extension and had to work around. The answer was as follows:
1) Create a custom error page (.ashx) and tell server to redirect all
404 errors to it.
2) Obtain the original request (with the service we were using it came
in as a url parameter on the request for the error404.ashx page).
3) Parse the original request into the target request using whatever
manner of processing suits. Unlike using web.config with this method
you can leverage regular expressions to allow more intelligent
processing and fewer mapping entries (e.g.
{ "^/dating/detail/(.*).htm","/pages/dating/detail.aspx?product=$1"})
4) Assuming a mapping is found, set the response status code to 200 and
use RewritePath, GetCompiledPageInstance and ProcessRequest to build
and serve back the page as required.
5) If the mapping was not found, return a simple 404 error page with
the original error code as the response status code.
This worked very neatly on this site (
www.scourtheweb.info/dating)
where you will see all links have a .htm extension. We don't actually
use this extension for files on the site (we use .html for static
files) so we know every .htm requires remapping.
The only other change we had to introduce was a condition in our global
exception logging code to make it ignore the exceptions raised by IIS
when it first realised the requested .htm file didn't exist.
One other fringe benefit of this, if you need to temporarily stop
remapping for whatever reason, you can create a complete or partial set
of .htm site files and put them on the server. This can be handily
stored in a subfolder that gets renamed to switch the alternative
static site on and then back off during site changes.
Ratty Atkins
Zero D Limited