MFCUCASE: Demonstrates Internet Server Filter DLLs

Click to open or copy the MFCUCASE project files.

The MFCUCASE sample demonstrates the use of MFC's support for Internet Server filter DLLs. MFCUCASE can be built as a project that uses MFC or one that doesn't use MFC, by choosing from the dropdown list of release types. When the project is built, the result is a filter DLL. You need Microsoft Internet Information Server (IIS) to run the sample. IIS is bundled with the Windows NT Server or can be purchased separately. For more information on Internet Server Filters, check the Microsoft Internet Information Server documentation. For more information on debugging Internet extension DLLs, see Technical Note 63.

The MFCUCASE filter watches for Uniform Resource Locators (URLs) that contain the directory name "/UC/". If the filter sees this character sequence in a URL, it maps the URL so that it no longer contains the "/UC/" string, and converts data from the URL site to uppercase before returning the data to the client. For example, if your server is named THUMPER and you have a file on it named Hockey.html, you might request "http://thumper/hockey.html" using your Web client software. With MFCUCASE installed, you could also request "http://thumper/uc/hockey.html" to get the file HOCKEY.HTML, with all strings displayed in the file converted to uppercase. You cannot request http://thumper/uc/ because MFCUCASE will not convert default pages to uppercase. MFCUCASE only converts files with an explicit filename in the URL path. You can enhance MFCUCASE by adding your own code to check whether a default file exists and supplying the filename "default.html" to MFCUCASE if it does.

Note that MFCUCASE converts all strings in the file to uppercase. This means that targets of jumps are converted to uppercase, which may break the jump.

Also note that the OnMapUrl and OnSendRawData functions always return SF_STATUS_REQ_NEXT_NOTIFICATION because their design never encounters the possibility for a fatal error. Handler functions should only return SF_STATUS_REQ_ERROR if they run into a situation that they can never recover from. Since the OnMapUrl and OnSendRawData samples in MFCUCASE can process a URL or a character string and decide the filter isn't needed when data is returned to the user, they don't ever return an error code. If the functions fail while loading resources or allocating memory, then they should be coded to return error codes.

Running the Sample

You'll need to add the MFCUCASE filter to your registry so the Internet Information Server loads it when you begin running the server. Add the full path and filename of your built MFCUCASE.DLL file to the registry key at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\Filter DLLs. If the key already has a filter listed, add a comma and your path to the end of the string. You'll need to restart the service (either by stopping the service and restarting it, or by rebooting your computer) for the service to load your filter DLL.