How to programmatically add or remove an ISAPI filter in IIS by using ADSI
This article was previously published under Q302988 We strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) version 7.0 running on Microsoft Windows Server 2008. IIS 7.0 significantly increases Web infrastructure security. For more information about IIS security-related topics, visit the following Microsoft Web site: http://www.microsoft.com/technet/security/prodtech/IIS.mspx (http://www.microsoft.com/technet/security/prodtech/IIS.mspx) For more information about IIS 7.0, visit the following Microsoft Web site: http://www.iis.net/default.aspx?tabid=1 (http://www.iis.net/default.aspx?tabid=1) On This PageSUMMARY
Global and site-level Internet Server Application Programming Interface (ISAPI) filter information is stored in the Internet Information Server (IIS) metabase or the Internet Information Services (IIS) metabase. You can access the metabase programmatically through the IIS Admin Objects (IISAO), which uses Active Directory Service Interfaces (ADSI), or through the IIS Admin Base Object (IISABO), which uses Microsoft Visual C++ interfaces. This article describes how to add and remove ISAPI filters in IIS by using ADSI.
Note The sample code in this article must be run with the security context of a member of the local Administrators group on the IIS server. Remove an ISAPI filter by using ADSIThe following sample code removes a global filter named "myFilter" from the ISAPI filters list on the master properties of the WWW Publishing service.
Note that to remove the ISAPI filter from memory, you must restart IISADMIN service.
TroubleshootingThe example that is provided in this article demonstrates how to add and remove global ISAPI filters. To add or remove site-level ISAPI filters, use GetObject("IIS://LocalHost/W3SVC/1/Filters") to reference the correct metabase node, instead of the GetObject("IIS://LocalHost/W3SVC/Filters") example that is used in this article. The "1" in "/W3SVC/1/" refers to the metabase site instance ID of the particular Web site (in this case, the default Web site).REFERENCES
For more information about how to manually add an ISAPI filter into IIS, click the following article number to view the article in the Microsoft Knowledge Base:
150312 (http://support.microsoft.com/kb/150312/)
How to install an ISAPI filter dynamic-link library
APPLIES TO
| Article Translations
|

Back to the top
