3
votes

I'm playing with http handlers. When adding an http handler to the web.config, in order to make it process special extensions on IIS 7, you need to register it under the system.webServer/handlers element. The add element there has an allowPathInfo attribute and I can't understand what is it for...

MSDN says:

Specifies whether the handler processes full path information in a URI, such as contoso/marketing/imageGallery.aspx. If the value is true, the handler processes the full path, contoso/marketing/imageGallery. If the value is false, the handler processes only the last section of the path, /imageGallery.

It doesn't help so much... Anyone?

Thanks, Shay.

1

1 Answers

7
votes

allowPathInfo (AllowPathInfoForScriptMappings prior to IIS7) is for handlers like CGI or WSGI that use the PATH_INFO environment variable as it is specified in the CGI spec, with only the trailing parts of the path passed in PATH_INFO.

IIS by default incorrectly sets PATH_INFO to the entire path including the part that's already stored in the SCRIPT_NAME, which will confuse anything that relies on the standard interpretation of the variable. ASP, on the other hand, wants the ‘bad’ setting.

The example quoted above seems a little misleading. It'd be when you had a script /example/example.cgi/foo: SCRIPT_NAME would always be /example/example.cgi; PATH_INFO should be /foo but if allowPathInfo isn't set, you get the whole /example/example.cgi/foo.

Incidentally, if you do turn allowPathInfo on, IIS will get PATH_INFO right... but PATH_TRANSLATED is now wrong. Sigh.