Add a Wildcard Script Map (IIS 7)

Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista

Add a wildcard script map when you want to configure an ISAPI extension to intercept every request before the request is sent to its mapped handler.

For example, you might have a handler that performs custom authentication and authorization against a database. You can configure a wildcard script map for the handler to intercept all requests to your application, and make sure that users are authenticated and authorized before they are served the requested page.

Note

After you add a wildcard script map, you must add the executable to the ISAPI and CGI Restrictions list to enable it to run. For more information about ISAPI and CGI restrictions, see Configuring ISAPI and CGI Restrictions in IIS 7.

Prerequisites

For information about the levels at which you can perform this procedure, and the modules, handlers, and permissions that are required to perform this procedure, see Handler Mappings Feature Requirements (IIS 7).

Exceptions to feature requirements

  • None

To add a wildcard script map

You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.

User Interface

To use the UI

  1. Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7).

  2. In Features View, on the server, site, or applicationHome page, double-click Handler Mappings.

  3. On the Handler Mappings page, in the Actions pane, click Add Wildcard Script Map.

  4. In the Executable box, type the full path or browse to the native handler (.dll or .exe file) that processes the request. For example, type systemroot\system32\inetsrv\myHandler.dll.

  5. In the Name box, type a friendly name for the handler mapping.

  6. Click OK.

  7. Optionally, on the Handler Mappings page, select a handler to lock or unlock it. When you lock a handler mapping, it cannot be overridden at lower levels in the configuration. Select a handler mapping in the list, and then in the Actions pane, click Lock or Unlock.

Command Line

To add a wildcard script map, use the following syntax:

appcmd set config /section:handlers /+[name='string',path='string',verb='string',modules="IsapiModule",scriptProcessor='string',resourceType='File | Directory | Either | Unspecified',requireAccess="None | Read | Write | Script | Execute"]

The variable **name **string is the name of the native handler, and path string is the file name extension or file name that the handler processes; for wildcard script maps, the value is *. The variable verb string is the HTTP verb or list of HTTP verbs to which to restrict the handler, such as GET, HEAD, POST, DEBUG; for wildcard script maps, the value is *. The variable scriptProcessor string is the physical path of the .dll file for the handler. The variable resourceType defines the resource to which the mapping applies; for wildcard script maps, the value is Unspecified. The variable requireAccess defines the type of access that the handler requires to run in a virtual directory; for wildcard script maps, the value is None.

For example, to add a wildcard script map for a native handler named CustomAuth, type the following at the command prompt, and then press ENTER:

appcmd set config /section:handlers /+[name='CustomAuth',path='*',verb='*',modules='IsapiModule',scriptProcessor='C:\Handlers\CustomAuth.dll',resourceType='Unspecified',requireAccess='None']

For more information about Appcmd.exe, see Appcmd.exe (IIS 7).

Configuration

The procedure in this topic affects the following configuration elements:

<handlers>

For more information about IIS 7 configuration, see IIS 7.0: IIS Settings Schema on MSDN.

WMI

Use the following WMI classes, methods, or properties to perform this procedure:

  • HandlersSection class (IIS)

  • HttpHandlersSection class (ASP.NET)

For more information about WMI and IIS, see Windows Management Instrumentation (WMI) in IIS 7. For more information about the classes, methods, or properties associated with this procedure, see the IIS WMI Provider Reference on the MSDN site.

See Also

Concepts

Configuring Handler Mappings in IIS 7