0

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?

Alex Che
  • 6,659
  • 4
  • 44
  • 53

2 Answers2

1

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.

Alex Che
  • 6,659
  • 4
  • 44
  • 53
0

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.

Valter Minute
  • 2,177
  • 1
  • 11
  • 13
  • Thanks for the answer. The "." mapping was the first thing I tried, but with no luck. Could you please elaborate your second alternative? Do you mean mapping a virtual root to the ISAPI extension DLL path? But how then to preserve the path translation for last part of a URL. Say if I map /isapi/ vroot to a asp.dll, how then will it translate dir/file part in the /isapi/dir/file URL to some real filesystem path? – Alex Che May 28 '14 at 07:59
  • You've to manage this inside your ISAPI and it may be complicated. Can you elaborate more about your issue. Why you need extension-less files? There's no way to avoid this limitation or to have all those files under a single dedicated folder (making ISAPI vroot management simpler)? – Valter Minute May 30 '14 at 07:01
  • I'm implementing a RESTful service and need extension-less URLs mostly for aesthetic reasons. I've managed to get what I want, please, see my answer. – Alex Che May 30 '14 at 07:20