.NET Framework Class Library
PageClientTarget Property

Gets or sets a value that allows you to override automatic detection of browser capabilities and to specify how a page is rendered for particular browser clients.

Namespace:   System.Web.UI
Assembly:  System.Web (in System.Web.dll)
Syntax
<[%$TOPIC/szahd1a1_en-us_VS_110_1_0_0_0_0%](False)> _
Public Property ClientTarget As [%$TOPIC/szahd1a1_en-us_VS_110_1_0_0_0_1%]
[[%$TOPIC/szahd1a1_en-us_VS_110_1_0_1_0_0%](false)]
public [%$TOPIC/szahd1a1_en-us_VS_110_1_0_1_0_1%] ClientTarget { get; set; }
[[%$TOPIC/szahd1a1_en-us_VS_110_1_0_2_0_0%](false)]
public:
property [%$TOPIC/szahd1a1_en-us_VS_110_1_0_2_0_1%]^ ClientTarget {
	[%$TOPIC/szahd1a1_en-us_VS_110_1_0_2_0_2%]^ get ();
	void set ([%$TOPIC/szahd1a1_en-us_VS_110_1_0_2_0_3%]^ value);
}
[<[%$TOPIC/szahd1a1_en-us_VS_110_1_0_3_0_0%](false)>]
member ClientTarget : [%$TOPIC/szahd1a1_en-us_VS_110_1_0_3_0_1%] with get, set
function get ClientTarget () : [%$TOPIC/szahd1a1_en-us_VS_110_1_0_4_0_0%] 
function set ClientTarget (value : [%$TOPIC/szahd1a1_en-us_VS_110_1_0_4_0_1%])

Property Value

Type: SystemString
A String that specifies the browser capabilities that you want to override.
Remarks

If you do not set the ClientTarget property, the HttpBrowserCapabilities object associated with the PageRequest property reflects the capabilities of the client browser. If you do set this property, client browser detection is disabled and the page will use browser capabilities associated with the value (alias) that you provide.

The root Web.config configuration file on the Web server computer defines the following default aliases that you can use as shorthand for common user-agent strings:

  • uplevel, which specifies browser capabilities equivalent to Internet Explorer 6.0.

  • downlevel, which specifies browser capabilities equivalent to older browsers that do not support client script. You can use this alias to determine how Web pages would work in a browser that has client script disabled.

You can set the alias programmatically using this property, or you can set it declaratively using the ClientTarget attribute of the @ Page directive.

You can define additional aliases in the clientTarget section of the application-level Web.config file. For more information, see clientTarget Element (ASP.NET Settings Schema).

Examples

The following code example defines an ie302 alias and includes sections needed to configure your application in its Web.config file. Using this alias, you can set the ClientTarget property to ie302 and customize pages specifically for Internet Explorer 3.02 browsers.

 <configuration>
   <system.web>
    <clientTarget>
     <add alias="ie302" useragent="Mozilla/2.0 (compatible; MSIE 3.02; Windows NT 3.5)" />
    </clientTarget>
   </system.web>
 </configuration>
Version Information

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1