@Page Directives: ClientTarget

01 March 2012 at 00:16

Setting the ClientTarget to a browser type tells the ASP.NET framework to render web controls with the capabilities specified by the type. Two values are available: uplevel and downlevel. More can very easily be added. Where is this specified? And what kind of rendering differences should be expected?

Uplevel and downlevel are aliases added to web.config in the root framework installation config directory:

<clientTarget>
    <add alias="uplevel" userAgent="Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.1)" />
    <add alias="downlevel" userAgent="Generic Downlevel" />
</clientTarget>

The userAgent is either the useragent string provided by the browser or one that has been specified in a browser definition file. For example, “Generic Downlevel” is the match attribute value of the userAgent element in the generic.browser file found in the browsers directory in the framework installation config directory. All manner of capabilities can be specified which tell ASP.NET how to render web controls. A downlevel browser will not receive any javascript from ASP.NET and so validation will be performed on the server instead.

References

ASP.NET Web Server Controls and Browser Capabilities

Determining Browser Capabilities in ASP.NET