Udostępnij za pośrednictwem


ASP.NET Browser Registration Tool (Aspnet_regbrowsers.exe)

The ASP.NET Browser Registration tool parses and compiles all system-wide browser definitions into an assembly and installs the assembly into the global assembly cache. The tool uses the browser definition files (.BROWSER files) from the .NET Framework Browsers subdirectory.

Note

For information about how to find the correct version of Asnet_regbrowsers.exe, see Finding the Correct Version of Aspnet_regbrowsers.exe later in this topic.

Syntax

aspnet_regbrowsers.exe <options>

Options

Option

Description

-?

Displays the Aspnet_regbbrowsers.exe Help text in the command window.

-i

Creates the runtime browser capabilities assembly and installs it in the global assembly cache.

-u

Uninstalls the runtime browser capabilities assembly from the global assembly cache.

Remarks

Browser definition files can be either system-wide or application-specific, and each type is stored in a different location. System-wide browser definition files are stored in the %SystemRoot%\Microsoft.NET\Framework\version\CONFIG\Browsers directory.

This directory contains predefined browser definition files that shipped with the corresponding version of the .NET Framework and any additional browser definition files copied there from software updates or service packs. Do not change the predefined browser definition files that come with ASP.NET, because service packs might update those files and overwrite your changes.

Application-specific browser definition files can be placed in the application's App_Browsers directory. In both locations, browser definition files must have a .BROWSER file name extension. Using the ASP.NET Browser Registration tool has no effect on application-specific browser definition files stored in an application's App_Browsers directory.

When browser definition files at the system level are modified, they do not automatically cause an update of browser capabilities for all applications. You must run the ASP.NET Browser Registration tool to update the browser capabilities assembly.

Note

The ASP.NET Browser Registration tool compiles browser definitions in the Browsers directory under %SystemRoot% that corresponds to the Framework directory under %WinDir% that you run the tool from. The version of the tool that is provided with the .NET Framework 2.0 updates the browser definition assembly for Web sites that target the .NET Framework 2.0, the .NET Framework 3.0, or the .NET Framework 3.5.

The ASP.NET Browser Registration tool parses and compiles all system-wide browser definitions into an assembly and installs the assembly in the global assembly cache. If there are errors in the system-wide browser definitions, the tool reports those errors. The browser capabilities assembly is used by all Web applications on the system. Note that you can also programmatically recompile system-wide browser definition files by using the BrowserCapabilitiesCodeGenerator class.

Behavior

When the ASP.NET Browser Registration tool runs, a new assembly is created and the effect on all Web applications is the same as if the Machine.config file was changed: All running Web applications are recycled and Microsoft Internet Information Services (IIS) is restarted. The tool also generates a random private token file, and creates a key file to sign the assembly so the assembly can be installed in the global assembly cache. The key file is removed when the tool is finished, leaving only the public key.

At run time, browser definition file information is merged into a collection of known browsers in a BrowserCapabilitiesFactory object. When a request is made, ASP.NET identifies the requesting browser by the request header, and compiles an HttpBrowserCapabilities object that corresponds to the type of the requested browser.

Note

The .NET Framework 1.1 stores browser definitions in the browserCaps element in the Web.config file. This section is deprecated in the .NET Framework version 2.0, but is still supported. The data in this element is merged with the information from the browser definition files.

Browser definition files at the application level are parsed and compiled with the other application source files. For a Web site project, compilation happens on demand when the application is started, and the application is automatically recompiled when any changes are made to the application's Browsers directory. The ASP.NET Browser Registration tool has no effect on application-level browser information files.

Examples

To parse and compile all system-wide browser definitions into an assembly and install the assembly into the global assembly cache, run the following command:

aspnet_ regbrowsers.exe -i

You can also use the tool to remove the browser definition assembly from the global assembly cache. The following command removes the browser definitions assembly from the global assembly cache:

aspnet_ regbrowsers.exe -u

To get help on using the ASP.NET Browser Registration tool, use the following command:

aspnet_ regbrowsers.exe -?

Finding the Correct Version of Aspnet_regbrowsers.exe

Aspnet_regbrowsers.exe is installed in the Microsoft.NET Framework directory. If the computer is running multiple .NET Framework versions side-by-side, multiple versions of the tool might be installed. The following table lists the locations where the tool is installed for different versions of the .NET Framework.

Version of .NET Framework

Location of Aspnet_regbrowsers.exe file

.NET Framework version 2.0, version 3.0, and version 3.5 (32-bit systems)

%windir%\Microsoft.NET\Framework\v2.0.50727

.NET Framework version 2.0, version 3.0, and version 3.5 (64-bit systems)

%windir%\Microsoft.NET\Framework64\v2.0.50727

See Also

Tasks

How to: Detect Browser Types in ASP.NET Web Pages

Concepts

ASP.NET Web Server Controls and Browser Capabilities

Securing Browser Definition Files

Reference

BrowserCapabilitiesFactory

Browser

HttpCapabilitiesBase

Browser Definition File Schema (browsers Element)