How do I programatically add a wildcard filter for IIS?
Question
I'm going to use System.DirectoryServices to programatically add a wildcard filter for IIS (Version 5.0 and IIS 6.0).
Anyone have some food for thought? Thanks in advance!
Solution
All you need to do is add the wild card to the metabase ScriptMap
property of the 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 example above maps the ASP.NET 2.0 ISAPI filter as the wild card filter.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow