Set a property for ISSWebFile in subfolder.

Recently I posted class that I am using to Programmatically set IIS Authentication for a page. Later I found that initial implementation almost never worked because  files in subfolders usually do not have explicit entries in the metabase, but inherit all properties from the parent. I've added code to create metabase entry (similar to this). But if the file is in subfolder, not in the virtual directory, adding the SchemaClassNames="IIsWebFile" doesn't work (see discussion Creating Virtual Directories using DirectoryEntry - HRESULT: 0x8000500F).

I've spend a lot of time triying to workaround this and finally ADSUTIL gave me a hint:
WARNING: The Object Type of this object was not specified or was specified as IIsObject.
This means that you will not be able to set or get properties on the object until the KeyType property is set.

The solution is to create object with SchemaClassName = "IIsObject" and then set
entry.Properties[“keyType“].Value = "IIsWebFile";
I've updated my class to fix the problem.

posted @ Friday, June 16, 2006 9:01 AM
Print

Comments on this entry:

# re: Set a property for ISSWebFile in subfolder.

Left by Gabriel L at 3/13/2007 2:52 AM
Gravatar
Hello,
I'm trying to do the same thing but using VBScript. Do you know how to port this solution onto VBScript?

# re: Set a property for ISSWebFile in subfolder.

Left by Michael Freidgeim at 3/13/2007 5:15 PM
Gravatar
Gabriel L,
Look at ADSUTIL.VBS file. It has a lot of code in VBScript, tat could be useful.

# re: Set a property for ISSWebFile in subfolder.

Left by Gabriel L at 3/13/2007 11:31 PM
Gravatar
I looked there but it's mostly what I did. It works when you want to create a virtual folder under an application but not under a deeper physical folder.

Your comment:



(not displayed)

 
 
 
 
 

Live Comment Preview:

 
«August»
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456