Вопрос

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?

Это было полезно?

Решение

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.

Другие советы

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>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top