Re: ADSI question by David
David
Wed Jun 30 04:14:35 CDT 2004
No, the ability to browse them in IIS Manager as directories (and not web
application) does not mean that they are IIsWebDirectories.
The only reason why IIsWebFile and IIsWebDirectory exist is so that you can
attach URL-level metadata, like logging, Access, etc, to the resources
themselves. Otherwise, you'd just use a IIsWebVirtualDir to declare the
URL-to-physical mapping as well as any URL-level metadata and let it
automatically inherit to the resources.
Thus, the UI isn't going to constrain you in any way because it's the only
means that you're able to manipulate the URL-level metadata. Thus, it shows
files/directories regardless if they are IIsWebFile or IIsWebDirectory or
not.
The way you can think of it is this:
- IISWebVirtualDir exists in the URL namespace able to give URL-level
metadata (like URL-to-physical mapping, execution permissions,
scriptmapping, MIME Map, etc)
- IIsWebDirectory is like IIsWebVirtualDir, except it cannot give a
URL-to-physical mapping.
- IIsWebFile is like IIsWebDirectory, except it is for file resources and
not directories (containership difference)
How ADSI fits into all this is that it requires a KeyType in order to
determine a schema for how to interpret its property values. Default is a
generic "object". Obviously, if you create something that IIS treats as
IIsWebDirectory from a metadata perspective, but you do not set its KeyType
as IIsWebDirectory, then you cannot manipulate this object from ADSI as a
IIsWebDirectory.
Thus, I suggest that when you create metabase nodes to store metadata that
you do it with the proper keytype such that you can access the appropriate
values via ADSI. UI is clearly no indication of the keytype of a node -- it
uses ABO, the underlying API layer which happens to not care about
KeyType -- it is convenient to use from C/C++, but ADSI is far preferred for
scripting, hence it has some restrictions.
--
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"abcd" <abcd@abcd.com> wrote in message
news:ee1hx8kXEHA.1652@TK2MSFTNGP09.phx.gbl...
Thanks David
Currently I have following directories and I can see those in IIS Manager
as directories (and not the web application), doesnt it mean that those are
an IISWebDirectory?
C:\inetpub\wwwroot\temp
C:\inetpub\wwwroot\temp\A123
OR Do I stilll need to create IISWebDirectory the way you have mentioned.
Thanks
David Wang [Msft] wrote:
> What is the keytype of /W3SVC/1/Root/Temp/A123. It needs to be
> IIsWebDirectory in order for you to be able to retrieve it as such.
>
> ' This is the correct way to create such a web directory
> ' If you create multiple grandchildren nodes at once, the
> ' intervening nodes won't have a KeyType and cannot be
> ' retrieved in the future (without effort).
> Set root = GetObject( "IIS://localhost/W3SVC/1/Root" )
> Set temp = root.Create( "IIsWebDirectory", "Temp" )
> temp.SetInfo()
> Set dir = temp.Create( "IIsWebDirectory", "A123" )
> dir.SetInfo()
>
> Set oIIS = GetObject("IIS://localhost/W3SVC/1/Root/Temp")
> Set oDir = oIIS.GetObject("IIsWebDirectory", "A123")