I have an installer that uses a VBScript to create and configure a new
virtual directory, and it works perfectly in IIS 6. Now I'm adapting the
script for IIS 7, and most of it works without changes (by going through the
IIS 6 compatibility API). But I've run into one item I can't get to work,
and I'm looking for advice or hints on how to do it.
The installation includes a custom error page for the 403.9 error. The IIS 6
script creates the virtual directory (assigned to VDirObj), sets a bunch of
attributes for it, and then does this:
lstCE = VDirObj.GetEx("HttpErrors")
For idx = 0 To UBound(lstCE)
If Instr(lstCE(idx), "403,9") Then
lstCE(idx) = "403,9,FILE," & FullPath & "403-9_TooManyUsers.htm"
End If
Next
VDirObj.PutEx 2, "HttpErrors", lstCE
VDirObj.SetInfo
In IIS 7, the newly initialized virtual directory doesn't have an entry in
the list for 403.9, so the loop ends without finding it, and nothing
happens.
I tried using the value 3 (APPEND) instead of 2 (UPDATE) in the PutEx call
to just add the entry:
VDirObj.PutEx 3, "HttpErrors", "403,9,FILE," & FullPath &
"403-9_TooManyUsers.htm"
There were no errors, but it didn't work -- the IIS manager didn't show any
change in the list of error pages, nor did it appear in the
applicationHost.config file. (I can add the page through the GUI, but that
doesn't help in what's supposed to be a one-button installer.)
I suppose I could add the entry directly to the XML in
applicationHost.config, but I'm curious to know if there's a simpler way
that actually works.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ:
http://word.mvps.org