Installing Wildcard Application Mappings
Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1
In IIS 6.0, administrators can configure a Web site or virtual directory to run an Internet Server API (ISAPI) application at the beginning of every request to that Web site or virtual directory, regardless of the extension of the requested file.
When an IIS Web server receives a request from a client, the Web server looks at the extension of the file that is named in the request to determine which ISAPI or Common Gateway Interface (CGI) application handles that file. For example, if a request comes in for a Web page called Default.asp, IIS knows from the application mapping list that Default.asp is handled by the Asp.dll ISAPI application.
If you want certain tasks to be executed for every client request before the requested page is sent to its mapped application, you can write an ISAPI Filter which intercepts requests as they arrive. However, ISAPI filters have the following limitations:
They cannot access the body of a request, only the headers.
They can only be configured per site, not per virtual directory.
They should not contain long-running operations because ISAPI filters are synchronous.
They are less flexible because the ISAPI filter API has less functionality than the ISAPI extension API, which is used to write ISAPI applications.
They are difficult to manage over time.
They are event-driven.
By using wildcard application maps, you can intercept every request before the requested page is sent to its mapped application. The effect is like having an Installing Wildcard Application Mappings that handles every file name extension. This is why the term wildcard is used to name this feature. Applications using wildcard application mapping can only be ISAPI applications.
A client request takes the following route:
An incoming request is handled by any existing ISAPI filters that are installed on the root Web site. The ISAPI filters are executed in order.
The request is sent to any existing wildcard application map applications, which are also executed in order. If the incoming request is for a Web file that is in a virtual directory, and there are wildcard application maps installed on the virtual directory and the root Web site, then only the wildcard application maps that are installed on the virtual directory are executed. If there are no wildcard application maps installed on the virtual directory, then the wildcard application maps that are installed on the Web site are executed. In other words, wildcard application maps are only inherited if none exist in the application where the requested Web file resides.
The IIS server looks at the application mappings table to determine which ISAPI application or CGI script specifically processes the requested file.
The response can be appended to at each stage and then sent back to the client.
Using Wildcard Application Mappings
Wildcard application maps can be used in the following scenarios:
Highly secure Web applications, such as banking applications, that require that every user who makes a request is authenticated against a database of user names, passwords, and account numbers. For example, once the user is authenticated, certain rules are created that specify what information the user can access. If the wildcard application map determines that the user has no rights, it can prevent the request from going any further, or it can send the request to a Web page other than the one that was requested. This custom authentication and authorization scheme can be implemented in an ISAPI application and installed as a wildcard application map. This way, all users must go through authentication, regardless of the file name extension they request.
E-commerce Web sites that display advertisements targeted to the interests of individual users. For example, when returning users make a request for a page, a wildcard application map application can examine their identity and then look up items that they previously viewed or purchased. Once the wildcard script map transfers control to the page that was requested, an advertisement that is appropriate to the user can be displayed.
Inserting Wildcard Application Mappings
By inserting wildcard application mapping, you can instruct IIS to allow ISAPI applications known as interceptors to intercept and examine every request before the requested page is sent to its mapped application. The effect is an application mapping that handles every file name extension.
Important
You must be a member of the Administrators group on the local computer to perform the following procedure or procedures. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run IIS Manager as an administrator. At a command prompt, type runas /User:Administrative_AccountName "mmc systemroot\system32\inetsrv\iis.msc".
To add a wildcard application mapping to a Web server or Web site
In IIS Manager, expand the local computer, expand the Web Sites folder, right-click the Web site or virtual directory that you want, and then click Properties.
Click the appropriate tab: Home Directory, Virtual Directory, or Directory.
In the Application settings area, click Configuration, and then click the Mappings tab.
To install a wildcard application map, do the following:
On the Mappings tab, click Insert.
Type the path to the DLL in the Executable text box or click Browse to navigate to it, select the Application Engine check box if the DLL is a script engine, and then click OK.
To edit or delete a wildcard application map, do the following:
In the Application extensions list, click the script map that you want to change.
Click Edit to alter the script map, or click Remove to remove the script map.
To change the order in which the wildcard application maps execute, rearrange the wildcard application maps in the Wildcard application maps (order of implementation) box by clicking the Move Up or Move Down button until they match the execution order you want.
Note
Do not list the same application more than once in your list of wildcard application maps.
Related Information
For information about developing wildcard application mappings, see Developing ISAPI Extensions and Filters and ISAPI Reference in the IIS Software Development Kit (SDK).
For information about regular application mappings, see Setting Application Mappings in IIS 6.0.