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?
-
1I know there's the %windir% symbol: http://technet.microsoft.com/en-us/library/cc754147%28v=ws.10%29.aspx but I don't know if there's something else. – ᗩИᎠЯƎᗩ Jul 30 '13 at 15:01
-
This is definitely heading in the right direction. I had not thought of the possibility of %windir% and possibly other environment variables being available in that context. Kudos to you. – bugmagnet Jul 31 '13 at 06:43
2 Answers
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.

- 1
- 1

- 16,531
- 6
- 62
- 96
-
Yes, not very clear. Not interested so much in "format strings" as much as in other "macros" (for want of a better word.) For instance, %s represents the requested script name. Does %a mean anything, etc? – bugmagnet Jul 31 '13 at 06:45
-
After doing some research, it looks like if you issue `%s` once it gives you the requested script name, a second utterance of `%s` will give you the parameters. However, I still have not yet found any Microsoft documentation of this. Everything I've found has been related to getting perl working under IIS. – OmnipotentEntity Jul 31 '13 at 07:03
-
Ok, here goes. I don't think Microsoft wants to advertise that this exists. They want people to use ISAPI, rather than relying on parameter passing. I see no indication that other than name and parameter any other format string exists. It's kinda weird because the posts I read on the IIS forums indicate this is due to `int main(int argc, char** argv)` but they're forgetting the subsequent `char** envp` and argc != script name, but I digress. – OmnipotentEntity Jul 31 '13 at 07:41
-
http://forums.iis.net/t/1176350.aspx <= source, probably either he doesn't or I don't know what we are talking about here. – OmnipotentEntity Jul 31 '13 at 07:43
It's not strictly related to your question but I post these 2 links as they are in some way connected and could be useful.
I've found how to use "@" and "$" to transform Web.Config, but I've found nothing on "%" that's not strictly related to environment variables.
First link: "@"
This first link explains the use of xdt:Transform and xdt:Locator attributes that you can use in Web.config transform files:
http://msdn.microsoft.com/en-us/library/dd465326.aspx
This example is an interesting use of Web.Config transformation using Conditions with "@":
<configuration xmlns:xdt="...">
<connectionStrings>
<add name="AWLT" connectionString="newstring"
providerName="newprovider"
xdt:Transform="Replace"
xdt:Locator="Condition(@name='oldname'
or @providerName='oldprovider')" />
</connectionStrings>
</configuration>
Second link: "$"
This second link shows how to use "$" to transform Web.Config avoiding the boring procedure to manually comment/uncomment Web.Config parts when deploying or testing in different servers:
http://andrewtwest.com/2010/02/25/using-web-config-transformations-in-web-site-projects/
An extract of the link, showing how to use MSBuild to transform Web.Config files starting from a Web Application project file:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\</OutputPath>
</PropertyGroup>

- 2,122
- 5
- 29
- 41