How do I programmatically add a substitution filter for IIS?

I'm going to use System.DirectoryServices to programmatically add a wildcard filter for IIS (version 5.0 and IIS 6.0).

Anyone have any food for thought? Thanks in advance!

+2


source to share


1 answer


All you need to do is add a wild card in the metabase property ScriptMap

site:

For example:



using (DirectoryEntry de = new DirectoryEntry("IIS://Localhost/W3SVC/2/ROOT"))
{
    de.Properties["ScriptMaps"].Add(
        @"*,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,0,GET,HEAD,POST");
    de.CommitChanges();
}

      

The above example renders an ASP.NET 2.0 ISAPI filter as a wildcard filter.

+4


source







All Articles