ASP.NET.in.a.Nutshell.Second.Edition [Electronic resources]

G. andrew Duthie; matthew Macdonald

نسخه متنی -صفحه : 873/ 144
نمايش فراداده

HttpBrowserCapabilities

System.Web (system.web.dll)class

This class allows you to take advantage of features enabled in the client's browser. It is automatically available through the Browser property of the built-in Request object and corresponds roughly to the MSWC.BrowserCapabilities component that existed in ASP. You can use this class to write browser-specific code for a web page or a custom web page control.

Essentially, the HttpBrowserCapabilities class is a list of properties that describe the client's browser. Many properties return True or False, depending on whether a given capability is enabled in the browser, such as ActiveXControls, BackgroundSounds, CDF (the channel definition format used in webcasting), Cookies, Frames, JavaApplets, JavaScript, and VBScript. Other Boolean values tell you whether or not the browser is AOL-based, a beta, and running on the Win16 or Win32 platform (the AOL, Beta, Win16, and Win32 properties, respectively). Additionally, you can retrieve information such as version number (MajorVersion and MinorVersion), the Platform name (e.g., "Win32"), the browser Type (e.g., "Microsoft Internet Explorer 5"), and the full Version number as a string.

public class 

HttpBrowserCapabilities : System.Web.Configuration.HttpCapabilitiesBase { // Public Constructors public

HttpBrowserCapabilities ( ); // Public Instance Properties public bool

ActiveXControls {get; } public bool

AOL {get; } public bool

BackgroundSounds {get; } public bool

Beta {get; } public string

Browser {get; } public bool

CDF {get; } public Version

ClrVersion {get; } public bool

Cookies {get; } public bool

Crawler {get; } public Version

EcmaScriptVersion {get; } public bool

Frames {get; } public bool

JavaApplets {get; } public bool

JavaScript {get; } public int

MajorVersion {get; } public double

MinorVersion {get; } public Version

MSDomVersion {get; } public string

Platform {get; } public bool

Tables {get; } public Type

TagWriter {get; } public string

Type {get; } public bool

VBScript {get; } public string

Version {get; } public Version

W3CDomVersion {get; } public bool

Win16 {get; } public bool

Win32 {get; } // Public Instance Methods public Version[ ]

GetClrVersions ( ); }

Hierarchy

System.Object System.Web.Configuration.HttpCapabilitiesBase HttpBrowserCapabilities

Subclasses

System.Web.Mobile.MobileCapabilities

Returned By

HttpRequest.Browser

Passed To

HttpRequest.Browser