Asp.net| Skills | browser
This article is quoted from the VS Help document
Query Browser Properties,
This property contains a HttpBrowserCapabilities object.
During an HTTP request, the object obtains information from the browser or from the client device.
So that your application knows the type and level of support the browser or client device provides.
The object then exposes information about the browser's functionality using strongly typed properties and a generic name-value dictionary.
The following code example demonstrates how to display browser information in a text box on a page.
=======
Visual Basic
=======
Private Sub button1_click (ByVal sender as System.Object, _
ByVal e as System.EventArgs) Handles Button1.Click
Dim s as String = ""
With Request.Browser
S &= "Browser capabilities" & VbCrLf
S &= "Type =" &. Type & VbCrLf
S &= "Name =" &. Browser & VbCrLf
S &= "Version =" &. Version & VbCrLf
S &= "Major Version =" &. MajorVersion & VbCrLf
S &= "Minor Version =" &. MinorVersion & VbCrLf
S &= "Platform =" &. Platform & VbCrLf
S &= "is Beta =" &. Beta & VbCrLf
S &= "is Crawler =" &. Crawler & VbCrLf
S &= "is AOL =" &. AOL & VbCrLf
S &= "is Win16 =" &. Win16 & VbCrLf
S &= "is Win32 =" &. Win32 & VbCrLf
S &= "Supports Frames =" &. Frames & VbCrLf
S &= "Supports Tables =" &. Tables & VbCrLf
S &= "Supports Cookies =" &. Cookies & VbCrLf
S &= "Supports VBScript =" &. VBScript & VbCrLf
S &= "Supports JavaScript =" & _
. Ecmascriptversion.tostring () & VbCrLf
S &= "Supports Java Applets =" &. Javaapplets & VbCrLf
S &= "Supports ActiveX Controls =" &. ActiveXControls & _
VbCrLf
End With
TextBox1.Text = S
End Sub
=====
C#
=====
private void Button1_Click (object sender, System.EventArgs e)
{
System.Web.HttpBrowserCapabilities browser = Request.Browser;
string s = "Browser capabilities<br/>"
+ "Type =" + browser. Type + "<br/>"
+ "Name =" + browser. Browser + "<br/>"
+ "Version =" + browser. Version + "<br/>"
+ "Major Version =" + browser. MajorVersion + "<br/>"
+ "Minor Version =" + browser. MinorVersion + "<br/>"
+ "Platform =" + browser. Platform + "<br/>"
+ "is Beta =" + browser. Beta + "<br/>"
+ "is Crawler =" + browser. Crawler + "<br/>"
+ "is AOL =" + browser. AOL + "<br/>"
+ "is Win16 =" + browser. Win16 + "<br/>"
+ "is Win32 =" + browser. Win32 + "<br/>"
+ "Supports Frames =" + browser. Frames + "<br/>"
+ "Supports Tables =" + browser. Tables + "<br/>"
+ "Supports Cookies =" + browser. Cookies + "<br/>"
+ "Supports VBScript =" + browser. VBScript + "<br/>"
+ "Supports JavaScript =" +
Browser. Ecmascriptversion.tostring () + "<br/>"
+ "Supports Java Applets =" + browser. Javaapplets + "<br/>"
+ "Supports ActiveX Controls =" + browser. ActiveXControls
+ "<br/>";
Response.Write (s);
}