Perhaps you've used my previous blog on IIS and missing file handlers to solve the problem of dynamically named folders or files. You might think that using the 404 handler in IIS in conjunction with your site wide missing template handler (set in the CFIDE Administrator) is your only option. What if you are on a shared server? Is there a way to implement a site by site missing template handler? Why yes Virginia there is.
The secret is to understand the sequence of how IIS and Coldfusion work together to handle a request. When IIS gets a request it uses the host header or IP address to find the correct site. At this point its job is to figure out which file or process to serve. Should it find a file on the disk or simply hand the request off to another process? When IIS sees a .cfm file it simply hands it to Coldfusion without even checking to see if its a legitimate template. Coldfusion must then figure out what to do with it. When the template doesn't exist, CF calls the "missing file handler" that is set up Coldfusion administrator. This handler applies to all Coldfusion sites on that server (or instance). That's where the problem lies. Multiple Coldfusion sites must all share the same missing file handler for CF requests. What is needed is a way to make IIS check to see if the file exists before it hands off to CF. That way it will call our carefully constructed CF 404 handler (see the previous post).
This is actually possible (though not intuitive). These instructions are for Win2003, IIS 6. Go to IIS and open your site properties. Click on the "home directory" tab and then click on the configuration button. If you have a typical setup you should see the Jrun wildcard entry in the bottom list box. Select this entry and click on "edit". There is a checkbox that says "verify that file exists". You might think that this means that IIS is supposed to verify that the wildcard dll exists. Nope... it means for IIS to make sure and verify that the file referenced in the request actually exists before throwing it to the Jrun. Like I said, it's not intuitive. Select this check box and click ok. Under the hood, IIS will verify that a file exists before handing it off to Coldfusion. If it does not exist it will call your 404 handler. Viola'!! ... A site specific CF missing template handler. Not bad.
Sometimes CF handles requests for files that do not exist, but are still legitimate requests. It does this by maintaining a list of URL patterns that match servlet processes. For example, RDS depends on a pattern of /cfide/ide.cfm. When CF sees this pattern it knows what to do with the request. It invokes the RDS servlet. Now, however, IIS is going to intercept that request before it gets to CF. To fix it you will have to create an ide.cfm file and put it into a cfide directory - just to fool IIS. Once the request get's to CF it will know what to do. Other processes that might suffer from this same problem (I'm talking off the top of my head here - without testing) are charting, flash forms, and flash remoting.