| |||||||||||||||||||
<browserCaps> filter ElementASP.NET Syntax ASP.NET Configuration Sections This element specifies a list of search strings that let you apply individual settings to specific browser definitions.
<filter> [ assignments, filter elements and case elements ] </filter> <filter match = "[ regular expression ]" with = "[ regular expression ]" > [ browser capability assignments, filter elements, case elements ] </filter> <filter> <case>...</case> </filter> Attributes and ElementsThe following sections describe attributes, child elements, and parent elements. Attributes
Child Elements
Parent Elements
RemarksThe browserCaps element specifies a list of search strings that let you apply individual settings to specific browser definitions. The rules that are contained in the list are applied in sequence. The first child case element that matches is evaluated and the remaining child case elements are ignored. Default ConfigurationIn the .NET Framework version 2.0, the filter element is not configured because the browserCaps element is deprecated in favor of using browser definition files to specify supported browsers and the capabilities for the browsers. For more information, see Browser Definition File Schema ( browsers Element ). In the .NET Framework versions 1.0 and 1.1, the default filter elements that are configured in the Machine.config file are too numerous 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 makes use of the .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 browserCaps element. The file specifies name/value pairs in the form of assignment statements, which are 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 AlsoASP.NET Configuration <browserCaps> Section <browserCaps> result Element <browserCaps> use Element |
| ||||||||||||||||||
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
You can help support aspxtreme