Geeks With Blogs

Michael Freidgeim's Blog MS .Net Development

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 on Friday, June 16, 2006 9:01 AM | Back to top


Comments on this post: Set a property for ISSWebFile in subfolder.

# re: Set a property for ISSWebFile in subfolder.
Requesting Gravatar...
Hello,
I'm trying to do the same thing but using VBScript. Do you know how to port this solution onto VBScript?
Left by Gabriel L on Mar 13, 2007 2:52 AM

# re: Set a property for ISSWebFile in subfolder.
Requesting Gravatar...
Gabriel L,
Look at ADSUTIL.VBS file. It has a lot of code in VBScript, tat could be useful.
Left by Michael Freidgeim on Mar 13, 2007 5:15 PM

# re: Set a property for ISSWebFile in subfolder.
Requesting 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.
Left by Gabriel L on Mar 13, 2007 11:31 PM

Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net | Join free