| |||||||||||||||||||
<browserCaps> SectionASP.NET Syntax ASP.NET Configuration Sections Specifies the settings of supported browsers and the capabilities of the supported browsers. The browserCaps element can be updated as required to specify new browsers and capabilities.
<configuration>
<system.web>
<browserCaps>
<result type = "System.Web.HttpBrowserCapabilities" />
<use var = "HTTP_USER_AGENT" />
[ browser capability property assignments ]
<filter>
<case match = "Windows 95 | Win95">
platform=Win95
</case>
<case match = "Windows NT | WinNT">
platform=WinNT
</case>
</filter>
</browserCaps>
</system.web>
</configuration>
Attributes and ElementsThe following sections describe attributes, child elements, and parent elements. Attributes
Child Elements
Parent Elements
RemarksThe browserCaps element specifies the settings of supported browsers and the capabilities for the supported browsers. The browserCaps element can be updated as required to specify new browsers and capabilities. For a list of valid browser properties, see HttpBrowserCapabilities. Lines of the form For more information about how to use regular expressions, see .NET Framework Regular Expressions. For the full browserCaps section, with a complete example of this syntax, see the Machine.config file that is installed with the .NET Framework. The name/value pairs that are captured with Default ConfigurationIn the .NET Framework version 2.0, the following limited default browserCaps element is configured in the root Web.config file because it is deprecated in favor of using browser definition files to specify supported browsers and capabilities. For more information, see Browser Definition File Schema ( browsers Element ). <browserCaps userAgentCacheKeyLength = "64">
<result
type = "System.Web.Mobile.MobileCapabilities, System.Web.Mobile,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</browserCaps>
In the .NET Framework versions 1.0 and 1.1, the default browserCaps element that is configured in the machine.config file is too large to list here. For updates to the browser data, go to cyScape, Inc.. Periodic device updates replace this browser capabilities section. ExampleThe following code example demonstrates how to parse the User-Agent HTTP header for any version of Microsoft Internet Explorer, as long as the format of the User-Agent string remains approximately unchanged. The example uses .NET Framework Regular Expressions and the ability of regular expressions to capture subexpressions in order to move version numbers directly from the User-Agent string to the HttpBrowserCapabilities object. The file specifies name/value pairs in the form of assignment statements, which is similar to Microsoft Internet Information Services ( IIS ) browscap.ini files. For example, the line <configuration>
<browserCaps>
<result type = "System.Web.HttpBrowserCapabilities, System.Web" />
<use var = "HTTP_USER_AGENT" />
browser=Unknown
version=0.0
majorversion=0
minorversion=0
frames=false
tables=false
cookies=false
backgroundsounds=false
<filter>
<case match = "^Mozilla[^(]*\(compatible; MSIE
(?'ver'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*))
(?'extra'.*)">
browser=IE
version=${ver}
majorver=${major}
minorver=${minor}
<case match = "^2\." with = "%{version}">
tables=true
cookies=true
backgroundsounds=true
<case match = "2\.5b" with = "%{version}">
beta=true
</case>
</case>
</case>
</filter>
</browsercaps>
</configuration>
See Also |
| ||||||||||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note