HOWTO: Make XSLISAPI2.DLL work on IIS 6.0
Overview
This is an "in-progress" blog entry where I document the steps necessary to get XSLISAPI2.DLL to work on IIS 6.0. This has been requested several times on the microsoft.public.inetserver.iis and microsoft.public.platformsdk.internet.server.isapi-dev newsgroups, so I decided to do a little investigation on what is going on with this ISAPI and IIS 6.0 and have a running documentary of the investigation.
Since the source code of the filter is completely given in the download (you can download and compile yourself), I presume it is user-supported.
If you'd permit me a moment for a side-comment -- notice how openly available source does not always work out -- even though the source code is openly available and there has been several itches that people have wanted to scratch, without the motivated people to SUPPORT the source code, the concept will not make it.
Ok, digression aside, let us look at what is going on within this ISAPI Filter and how to make it work on IIS 6.0
Observations
I have only read through about 30% of the ISAPI Filter source code, and I can say that this ISAPI Filter has several flaws in it, some of which are exposed by IIS 6.0, and they prevent it from functioning. The issues (and resolution) are:
- In IISFilter.cpp::CheckVFileForSSL() , the filter incorrectly assumes that the AccessSSLFlags property is set for any given URL and then fails if it is not. This is simply not a valid assumption and can cause custom error behavior on IIS to be strange.
- Notice that the filter affects 404 responses when the URL extension is not 3 or 4 characters. Try /pagerror.gif , /pagerror.gif1 , and /pagerror.gif12 and you will notice the difference.
- The Filter tries to determine the file extension of the URL in SF_NOTIFY_PREPROC_HEADERS, which is completely wrong. It is simply not possible, especially if there is another ISAPI Filter that changes the URL. One can come up with a legitimate ISAPI Filter which will break this filter, and there is no band-aid fix for this flaw.
- Global.h::g_szSourceFile is set to "SSXSLSRCFILE:" and is subsequently used in two places, IISFilter.cpp::LogFilterEvent() and IISFilter.cpp::HttpFilterProc() . However, the code is incorrect in IISFilter.cpp::LogFilterEvent() and takes advantage of an IIS5 bug (fixed in IIS6). Namely, "HTTP_SSXSLSRCFILE:" is not a valid request header name for a call to HTTP_FILTER_CONTEXT::GetServerVariable(). It needs to be "HTTP_SSXSLSRCFILE" (without the ":"). The quick fix, of course, is to introduce a g_szSourceFile2 variable alongside g_szSourceFile, without the trailing ":", and use it ONLY in IISFilter.cpp::LogFilterEvent()
- <TBD> as people help iterate through any remaining issues from IIS by providing me comments on what is/not working, what configuration is necessary, and any sample files to reproduce the issue. I do not know what XSLISAPI2.DLL is supposed to do; I can only help on the ISAPI Filter portion.
Work-around Steps
- Download xslisapi.exe from: https://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=2EA4F409-65D6-4101-8D4E-ADD53D4521C7
- Extract the files to anywhere that is not web-accessible
- Edit Global.h to include:
const char g_szSourceFile2[] = "SSXSLSRCFILE"; - Edit IISFilter.cpp::LogFilterEvent() to use g_szSourceFile2 instead of g_szSourceFile.
*** Important: Leave the one in IISFilter::HttpFilterProc() alone. It is correct ***
char szSrcFileEnvVariable[6 + sizeof(g_szSourceFile2)];
wsprintfA(szSrcFileEnvVariable,"HTTP_%s",g_szSourceFile2); - If you do NOT have SSL set up, use the following (where ### is the ID of your website):
CSCRIPT %SYSTEMDRIVE%\Inetpub\adminscripts\adsutil.vbs SET W3SVC/###/ROOT/AccessSSLFlags 0 - <TBD> For remaining issues.
//David
Comments
Anonymous
May 23, 2005
The comment has been removedAnonymous
May 26, 2005
Thanks Trey for the context. I have never implemented nor supported any solution using XSLISAPI2.DLL, so I really have no idea what it all looks like. :-/
I basically come to the issue from the perspective of IIS and ISAPI Filter behavior as I can deduce by reading the source code of XSLISAPI2.DLL.
If you still require more work-around steps to have the XSLISAPI2.DLL portion of the solution working, please feel free to give me some more context/sample files that illustrate the issue. For example, I have yet to see what a sample .pasp nor .xsl file look like, nor of the settings on the rest of the website.
//DavidAnonymous
June 06, 2005
This doesn't even work
can't add a simple wildcard application mapAnonymous
June 10, 2005
I am not certain what you mean by "this does not even work". XSLISAPI2.DLL is an ISAPI Filter and needs to be configured as such. You literally cannot configure it as a wildcard scriptmap because it is not the right type of DLL.
Can you please clarify what you are actually trying to do?
//DavidAnonymous
September 12, 2007
I'm sorry to drag up a 2 year old thread, but i'm trying to figure out why I can't get access to the querystring when using XSLISAPI on IIS6. I can access all of the Request.ServerVariables items except Request.ServerVariables("QUERY_STRING"), which shows as blank from within my asp code. Also, I can access all of my Request.Form items, but I can't see any Request.QueryString items. I've compared results between a Win2000 server and a Win2003 server and the querystring is the only thing that I can't access when I'm using XSLISAPI.Anonymous
September 16, 2007
The comment has been removed