ControlAdapter::Browser Property
Gets a reference to the browser capabilities of the client making the current HTTP request.
Assembly: System.Web (in System.Web.dll)
Property Value
Type: System.Web::HttpBrowserCapabilitiesAn HttpBrowserCapabilities specifying client browser and markup capabilities.
A ControlAdapter object determines the client browser capabilities from the HttpBrowserCapabilities object that is returned by the Browser property. This enables the ControlAdapter object to render browser-specific markup or otherwise modify the behavior of the Control.
The following code example shows how to use the Browser property to access the details of the requesting browser. In this example, the code checks to determine whether the browser is compatible with JavaScript, and then allows the developer to render customized output in that case.
#using <System.Web.dll> #using <System.dll> using namespace System; using namespace System::Web::UI; using namespace System::Web::UI::Adapters; public ref class CustomControlAdapter: public ControlAdapter { protected: virtual void Render( HtmlTextWriter^ writer ) override { // Access Browser details through the Browser property. Version^ jScriptVersion = Browser->JScriptVersion; // Test if the browser supports Javascript. if ( jScriptVersion != nullptr ) { // Render JavaScript-aware markup. } else { // Render scriptless markup. } } };
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.