We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

Metabase Compatilbility issues with reading overridden Inherited propertiesRSS

1 reply

Last post Oct 03, 2007 08:22 PM by rayner

  • Metabase Compatilbility issues with reading overridden Inherited properties

    Aug 22, 2007 10:43 AM|KGM|LINK

    Hi,
    We're having trouble setting ScriptMaps on websites using metabase calls. When we add scriptmaps for PHP or Perl using the following code, the scriptmaps get added at the Server Level instead of the WebSite. The WebSite gets the scriptmap but it's inherited. 

    DirectoryEntry entry = new DirectoryEntry(pathToSite);
    entry.Properties["ScriptMaps"].Add(mapForPhp); 

    If we overwrite the scriptmaps completely, they do get added at the WebSite level but that's not without problems.  

    DirectoryEntry entry = new DirectoryEntry(pathToSite);
    PropertyValueCollection scriptMapsCollection = entry.Properties["ScriptMaps"];
    scriptMapsCollection.Add(mapForPhp);
    entry.Close();
    DirectoryEntry entry = new DirectoryEntry(pathToSite);
    entry.Invoke("Put", new object[] { "ScriptMaps", "" });  

    entry.Properties["ScriptMaps"].Add(scriptMapsCollection);  

    Let's say we now need to add the scriptmap for perl (.pl). When executing PropertyValueCollection scriptMapsCollection = entry.Properties["ScriptMaps"];   we don't get the .php scriptmap (since entry.Properties["ScriptMaps"] only returns the inherited maps). If we now add .pl to the collection and overwrite the site's scriptmaps collection, it will remove the .php scriptmap since that never showed up in the inherited list.The above also has the nasty side-effect of messing up the DotNet scriptmaps. After performing the above operation, we are unable to modify the DotNet version on the Application Pool. See the thread : http://forums.iis.net/t/1134372.aspx 

    Strangley the Metabase Explorer that comes with IIS 6.0 seems to know exactly what to do. It asks if I want to override the inherited setting for the scriptmap and add it at the website level. When I say yes, it adds the exact same entry that gets added with the code above. The only difference is that it can find the entry the next time.

    KM 

     

  • Re: Metabase Compatilbility issues with reading overridden Inherited properties

    Oct 03, 2007 08:22 PM|rayner|LINK

    Hi KM,

    Please can you provide the samples for the values of "pathToSite" and "mapForPhp"

    Thanks,

    Rayner

    configuration ScriptMaps

    Rayner D'Souza
    Software Design Engineer
    IIS Team
    Microsoft Corporation