Export (0) Print
Expand All

Page.ClientTarget 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)

public string ClientTarget { get; set; }
/** @property */
public String get_ClientTarget ()

/** @property */
public void set_ClientTarget (String value)

public function get ClientTarget () : String

public function set ClientTarget (value : String)

Not applicable.

Property Value

A String that specifies the browser capabilities that you want to override.

If you do not set the ClientTarget property, the HttpBrowserCapabilities object associated with the Page.Request 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 named alias. In particular, each alias has a user-agent definition.

The configuration file (Web.config) on your Web server computer defines four default aliases you can use as shorthand for common user agent strings. These defaults are ie5, which allows you to customize pages for Microsoft Internet Explorer 5.5 browsers, ie4, which allows you to customize pages for Internet Explorer 4.0 browsers, uplevel, which allows you to customize pages for Internet Explorer 4.0 and later, and downlevel, which allows you to customize pages for browsers earlier than Internet Explorer 4.0.

You can set the alias string programmatically using this property, or you can set it declaratively using the @ Page directive's ClientTarget attribute. If you want to customize the response that a page sends to browsers beyond the four defaults, define a new alias in the <clientTarget> section of the application-level configuration file (Web.config) and then set this property to that alias. For more information, see ASP.NET Configuration Overview.

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>

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft