« Previous Next »

Thread: Metabase Property Inheritance (IIS 6)...how to tell?

Last post 10-02-2007 9:54 AM by qword. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 09-26-2007, 12:21 PM

    • kevinkenny
    • Not Ranked
    • Joined on 01-19-2006, 2:14 PM
    • Scotland
    • Posts 7

    Metabase Property Inheritance (IIS 6)...how to tell?

    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

     

  • 10-02-2007, 9:54 AM In reply to

    • qword
    • Top 150 Contributor
    • Joined on 07-04-2007, 7:53 AM
    • Posts 44

    Re: Metabase Property Inheritance (IIS 6)...how to tell?

    There is an inherit attribute. Can we use this attribute? 

Page 1 of 1 (2 items)
Microsoft Communities