Httpd's ScriptMap for extensionless URLs

91 views Asked by At

There is a way to configure the Windows CE HTTPD server, so that it will load some defined ISAPI Extension (e.g., asp.dll) for a defined file extension (e.g., ".asp").

What is the easiest way to make it load some ISAPI Extension for extensionless file names in URLs?

2

There are 2 answers

0
Alex Che On BEST ANSWER

At the end I have not found another way to accomplish my goal, but to create a special ISAPI filter just for this. This is a simple ISAPI filter, that handles the SF_NOTIFY_URL_MAP server event and changes the pszPhysicalPath variable according to extension mapping settings. To make it a little more general, I made it to support not only mapping from extension-less paths, but to map from any to any extension. The mappings are set in Windows Registry.

How it works, basically:

  1. A request gets to the HTTPD server, say to URL /vroot/file
  2. The server maps /vroot/file to some physical path, say \disc\vroot\file
  3. The server calls the filter with the physical path, and the filter maps it to, say, \disc\vroot\file.asp, according to it's settings.
  4. The server then handles the file correctly with the asp.dll, according to the ScriptMap registry settings.

In case someone needs it, I've published the source code on GitHub.

3
Valter Minute On

Did you try to use "." as file estension? Never tried myself, it's just an idea. Or you may use an ISAPI extension and re-define a whole virtual root, but this applies to all requests under that root, not just file names with no extension.