Search code examples
iisweb-configscriptprocessor

IIS web.config, any other % symbols apart from %s?


Regarding the scriptProcessor in the handlers section of IIS's web.config, are there any % symbols apart from %s (which seems to represent the requested filename)? For example, is %a a recognised macro/symbol? If there are others besides %s, where are they described?


Solution

  • Your question is a bit unclear, so I had to make a number of assumptions in order to answer it. Please let me know if I got anything wrong.

    From the documentation:

    Script Processor

    Optional string attribute.

    Specifies the physical path of the ISAPI extension .dll file or Common Gateway Interface (CGI) .exe file that processes the request.

    The scriptProcessor attribute is required only for script map handler mappings. When you map a handler to an ISAPI extension, you must specify ISAPIModule for the modules attribute. When you map a handler to a CGI file, you must specify CGIModule for the modules attribute.

    From the documentation, we don't see any mention of format strings at all. If there were format strings, what would you replace them with? There's no clear answer based on the XML. Perhaps you're mistaking an environment variable for a format string. Or your particular configuration setup has some post processing that's ran on it before it's pushed live.

    If we are actually talking about environment variables, then you can view them by issuing Win+Break to bring up system settings, go to advanced, then open up environment variables. You may also define your own. To use any environment variable you can use %variablename% as you would in a standard .bat file.

    EDIT: Upon greater research, I've found the following. %s will give you the script name, then %s again will give you the parameters foo=bar. This feature isn't advertised (that I can find) in any official IIS documentation. I strongly suspect that it's considered a deprecated feature. And they're pushing hard to make ISAPI the norm.

    Because of how it's structured (ie like a standard format string) I suspect that trying other common format strings (%d %c %f) might yield you something interesting, but probably not. It looks like this was a very specific solution to a very specific problem.