Adding a Filter

You can install multiple filters in IIS. The notification order is based on the priority you specified in the filter. If you have set two filters to the same priority for a particular event, the order the filters were loaded into memory determines which filter is notified first. You can configure the IISFilters object in the metabase to determine the load order.

In previous versions of IIS, all filters were notified of events they had registered for, regardless of which IIS service was involved. In IIS 4.0 and later versions, filters can be set either globally or they can be configured to only receive notifications for events that take place within a particular service. For example, you can configure a filter to apply only to FTP events, or only to Web events.

Filters can be added to a Web Site either programmatically or with the Internet Service Manager snap-in to the Microsoft Management Console. Information on adding a filter with the Internet Service Manager is available in the Installing and ISAPI filter topic.

The following script demonstrates adding a filter to a Web Site with a script.

<%
Dim CurrServer
Set CurrServer = GetObject("IIS:/LocalHost/W3svc/Filters")
CurrServer.Create("IIsFilter", "MyFilter") 
CurrServer.SetInfo

%>

A more complete example is provided in the \Inetpub\iissamples\sdk\admin sub-directory.