共用方式為


<clientTarget> Element

Adds aliases for specific user agents to an internal collection of user agent aliases.

<configuration>
   <system.web>
      <clientTarget>

<clientTarget>
   <add alias="alias name to use" 
        userAgent="identification of user agent"/>
   <remove alias="alias name to remove"/>
   <clear/>
</clientTarget>

Subtags

Subtag Description
<add> Adds an alias for a specific user agent to an internal collection of user agent aliases.
<clear> Removes all aliases currently contained in or inherited by the specified Web.config file.
<remove> Removes the specified alias from the list of aliases. The value of <remove> must exactly match that of a previous <add> directive. Wildcard selections are not supported.

Example

The following example adds four user agent aliases.

<configuration>
   <system.web>
      <clientTarget>
         <add alias="ie5" userAgent="Mozilla/4.0 (compatible;MSIE 5.5;Windows NT 4.0)"/>
         <add alias="ie4" userAgent="Mozilla/4.0 (compatible;MSIE 4.0;Windows NT 4.0)"/>
         <add alias="uplevel" userAgent="Mozilla/4.0 (compatible;MSIE 4.0;Windows NT 4.0)"/>
         <add alias="downlevel" userAgent="Unknown"/>
      </clientTarget>
   </system.web>
</configuration>

Remarks

The collection of user agent aliases indicates the target user agents that ASP.NET server controls should render content for.

Requirements

Contained Within: <system.web>

Web Platform: IIS 5.0, IIS 5.1, IIS 6.0

Configuration File: Machine.config, Web.config

Configuration Section Handler: System.Web.Configuration.ClientTargetSectionHandler

See Also

@ Page | ASP.NET Configuration | ASP.NET Settings Schema