I have a folder on my site called pdfproofs that I do not want to allow
directory browsing on.
However, I am dynamically creating subfolders underneath it that I DO want
to allow directory browsing on.
Is there any way that I can set IIS to do this without having to go in
manually every time a new subfolder is created to change the option?
Thanks
I don't know of a way to do this, but what I would do is enable
directory browsing for this folder, but enable a default document like
_index.htm, and drop one in with just "Directory Browsing is not
enabled" in it (or even a .asp page which redirects you to somewhere
else).
HTH
Paul
Checkout the IIsWebDirectory COM object, in particular the DirBrowseFlags
property.
You'll probably need to be authenticated to create/use these type of objects
in asp - anonmymous users tend to fail with access denied errors. If your
creating them within a service or app then you should have enough rights
arlready.
I haven't actually used IIsWebDirectory but here's a snippet of asp where I
use the IIsWebServer object:
private sub inc_IIS_CheckServerId( ByRef nWebServerInstance )
' if instance = -1 then get the instance of the current web site
if nWebServerInstance = -1 then
nWebServerInstance = CInt( Request.ServerVariables("INSTANCE_ID") )
end if
end sub
private function inc_IIS_GetWebServer( ByVal nWebServerInstance )
' returns an IIsWebServer object for the web server instance given
dim sComputerPath
call inc_IIS_CheckServerId( nWebServerInstance )
sComputerPath = "IIS://" & Request.ServerVariables( "SERVER_NAME" ) & _
"/w3svc/" & CStr(nWebServerInstance)
set inc_IIS_GetWebServer = nothing
set inc_IIS_GetWebServer = GetObject( sComputerPath )
if not inc_IIS_GetWebServer is nothing then
if inc_IIS_GetWebServer.Class <> "IIsWebServer" then
set inc_IIS_GetWebServer = nothing
end if
end if
end function
Hope this helps,
Ed.