Hi Folks,
Without actually parsing metabase.xml, is there a way to tell if a metabase property is inherited from its parent? For example the Default Website inherits the ScriptMaps property from <IIsWebService Location="/LM/W3SVC />. If I add, remove a or modify a scriptmap, in IIS MMC or using System.DirectoryServices, then the ScriptMap property is copied to the <IIsWebVirtualDir Location ="/LM/W3SVC/1/ROOT"/> node where previously it wasn't present.
My problem is how to tell using System.DirectoryServices.DirectoryEntry.Properties["ScriptMap"].Value if this property is overridden or inherited. The reason I ask is that I am building an addin for our admin system. This will allow our support guys (and eventually customers) to turn a folder into an application (and delete if need be). The problem is that when the application is removed, IIS leaves behind a <IIsWebDirectory /> artifact with all properties removed. i.e. it goes from being an app like this -
<IIsWebDirectory Location ="/LM/W3SVC/10000/root/somedir"
AppFriendlyName="somedir"
AppIsolated="2"
AppPoolId="DefaultAppPool"
AppRoot="/LM/W3SVC/10000/Root/somedir"
/>
to
<IIsWebDirectory Location ="/LM/W3SVC/10000/root/somedir" />
I need to check if an IIsWebDirectory already exists at a metabase path before attempting to create. This left behind artifact node, when opened with System.DirectoryServices, just looks like a normal IIsWebDirectory complete with AppIsolated, AppPoolId properties because they are inherited from the /root app.
I could load the metabase into a DOM and selectSingleNode("/IIsWebDirectory[@Location='/LM/W3SVC/123/root/myapp]) and test for the existance of the raw attributes, but that just seems plain dirty.
Any ideas?
Cheers
Kev