IIS 6 and Invalid CGI Filename
I got this question a couple of days ago.
I am getting this error message whenever i try to click on Help Menu on my site that is running on IIS 6:
Other - Exception: Formatting Response - EFOpenError Cannot open file
This help menu calls a CGI & dll file, so I tried adding these files extention on Aplication extention within IIS but I am still getting the same error I tried using FileMon to help me resolving this issue and I got the following:
412 3:33:44 PM w3wp.exe:3288 OPEN F:\InetPub\wwwroot\merchxfer\cgi-bin/help_web_sales.html NAME INVALID Options: Open Access: All
The first step to allowing CGI and ISAPI DLL to run is to add them to Web Service Extension and enable them. However, that merely allows IIS to load and execute the binary code. It does not mean that code runs and does the right thing, as we see here.
There are two things that you should note.
\\?\F:\Inetpub\wwwroot\merchxfer\cgi-bin / help_web_sales.html
- The \\?\ prepended to the filename
- The forward-slash '/' character in the filename
The \\?\ originates from IIS6 and is a security measure. It is valid Win32 File IO syntax and turns off any filename canonicalizations, assuring that IIS gets exactly the file resource that the user requested.
The forward-slash '/' is probably what is causing problems for the CGI. Forward-slash is not a valid character in NTFS, so there is no way that the file resource can be opened. This is confirmed by FileMon reporting NAME INVALID.
If this CGI worked on prior versions of IIS, it likely worked by accident. Without debugging the CGI, it will not be possible to determine the cause of the '/', but my guess would be that the problem is with the CGI. Given a URL to /cgi-bin/cgi.exe/help_web_sales.htm , it likely picked up:
- \\?\F:\Inetpub\wwwroot\merchxfer\cgi-bin from the CGI variable PATH_TRANSLATED
- /help_web_sales.htm from the CGI variable PATH_INFO
And the CGI is responsible for turning that information into a valid filename prior to using it as such.