Tony
Fri Feb 24 00:40:57 CST 2006
Thanks for the tips...
"David Wang [Msft]" <someone@online.microsoft.com> wrote in message
news:ObJfmi2NGHA.3988@TK2MSFTNGP09.phx.gbl...
> Correct.
>
> The issue with using the pathname directly is that you have to create all
> the parent nodes before being able to create the child node.
>
> For example, you can't create the W3SVC/1/ROOT/WebDir/WebFile "IIsWebFile"
> without first creating the W3SVC/1/ROOT/WebDir "IIsWebDirectory".
>
> --
> //David
> IIS
>
http://blogs.msdn.com/David.Wang
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> //
>
> "Tony Molono" <tonymolono@hotmail.com> wrote in message
> news:u2TBRbrNGHA.3196@TK2MSFTNGP09.phx.gbl...
>> Ok, interesting...
>>
>> So if I want to set a property on every file on a web site the pattern
>> would looks something like this?
>>
>> - Get a list of sites
>> - For each site, get a list of VDIRS (which starts with ROOT)
>> - For each VDIR, get its physical path
>> - For each directory in physical path get each file
>> - For each file, open the path using DirectoryServices (?)
>> - For each file DirectoryEntry, set the property (?)
>>
>> Something like DirectoryEntry de = new DirectoryEntry("LM/W3SVC/1/ROOT/"
>> + Phsyical Relative File Path)
>>
>> Thanks,
>>
>>
>> "David Wang [Msft]" <someone@online.microsoft.com> wrote in message
>> news:ODIjwRrNGHA.2696@TK2MSFTNGP14.phx.gbl...
>>> IIS Configuration only stores the virtual-to-physical mapping of the URL
>>> namespace. IIsWebFile and IIsWebDirectory objects allow arbitrary
>>> metadata in the URL namespace -- they are *not* representative of the
>>> physical file/directory in the URL namespace (i.e. there is no guarantee
>>> that every web accessible directory/file has an associated
>>> IIsWebFile/IIsWebDirectory).
>>>
>>> If you want to enumerate "all physical files and directories" that are
>>> under the URL namespace, you first enumerate the URL Namespace using
>>> DirectoryServices or System.Management. Then for every URL namespace
>>> element, like a Virtual Directory, manually resolve the physical
>>> directory from the virtual-to-physical mapping with System.IO.
>>>
>>> --
>>> //David
>>> IIS
>>>
http://blogs.msdn.com/David.Wang
>>> This posting is provided "AS IS" with no warranties, and confers no
>>> rights.
>>> //
>>>
>>> "Tony Molono" <tonymolono@hotmail.com> wrote in message
>>> news:%230n9G$qNGHA.524@TK2MSFTNGP09.phx.gbl...
>>>> Hey everyone,
>>>>
>>>> This is one of those questions that is probably so basic that nobody
>>>> ever bother to write down an answer. How the heck am I suppose to
>>>> enumerate the files and non-virtual directories in an IIS Web Site.
>>>> Using C#, I am able to easily use DirectoryServices to get a list of
>>>> sites and to enumerate all the VDIRs in a site, but I can't seem to
>>>> figure out how I am suppose to get a list of all the physical files and
>>>> directories in that site.
>>>>
>>>> Should I be using DirectoryServices, or System.Management or perhaps
>>>> System.IO? I can't find the missing link. What confuses me even more
>>>> is that when I use the IIS Resource Tool Metabase Browser, it doesn't
>>>> show me the physical files either. Just the VDIRs :(.
>>>>
>>>> I have seen code samples that use DirectoryServices to get a
>>>> DirectoryEntry, they then enumerate through the DE's children and test
>>>> the "SchemaName" - for me though, my ROOT directory always has one (or
>>>> two children) that are just VDIRS and those directories have no
>>>> children. There is nothing for me to loop through, I want the
>>>> IISWebFile and IISWebDirectory objects!
>>>>
>>>> Thank you for your time and help in this matter.
>>>>
>>>
>>>
>>
>>
>
>