Server Intellect
 
Home   Asp.Net Tutorials   What's New   Newsletter   More Resources
 
 
  Categories
Advanced Technologies
AJAX
Internet Browsers
Controls
Database
Email
Error Handling
File
Graphics
Website Navigation
Network
Performance
User Interface and Themes
Validation
Visual Web Developer
Web Services
XML
Suggest Tutorial


Navigator: Home - Tutorials - Internet Browsers - To show browser capabilities using ASP.NET 2.0 and C#
To show browser capabilities using ASP.NET 2.0 and C#


ASP.NET Internet Browsers Tutorial

This tutorial will show you how to gather your web browser capabilities using ASP.NET 2.0 and C#.

The class of HttpBrowserCapabilities will enable the server to gather information on the capabilities of the browser that is running on the client. Namespace of this class: System.Web.

First, import the namespace of System.Web:

using System.Web;

Server Intellect offers Windows Hosting Dedicated Servers at affordable prices. I'm very pleased!

In order to use the class of HttpBrowserCapabilities, we need initialize an instance of Request.Browser object. Then we can use this class to list IE properties.

HttpBrowserCapabilities bc = Request.Browser;
Label1.Text = "Welcome! You are using" + bc.Browser + "v." + bc.Version + "on a" + bc.Platform + "machine";

ActiveControls.Text = bc.ActiveXControls.ToString();
AOL.Text = bc.AOL.ToString();
Beta.Text = bc.Beta.ToString();
BackgroundSounds.Text = bc.BackgroundSounds.ToString();
Browser.Text = bc.Browser.ToString();
CDF.Text = bc.CDF.ToString();
Cookies.Text = bc.Cookies.ToString();
Crawler.Text = bc.Crawler.ToString();
Frames.Text = bc.Frames.ToString();
JavaApplets.Text = bc.JavaApplets.ToString();
EcmaScriptVersion.Text = bc.EcmaScriptVersion.ToString();
win16.Text = bc.Win16.ToString();
Version.Text = bc.Version.ToString();
VBScript.Text = bc.VBScript.ToString();
win32.Text = bc.Win32.ToString();
Type.Text = bc.Type.ToString();
Tables.Text = bc.Tables.ToString();
Platform.Text = bc.Platform.ToString();
MajorVersion.Text = bc.MajorVersion.ToString();
MinorVersion.Text = bc.MinorVersion.ToString();
MsDomVersion.Text = bc.MSDomVersion.ToString();

We used over 10 web hosting companies before we found Server Intellect. Their dedicated servers and add-ons were setup swiftly, in less than 24 hours. We were able to confirm our order over the phone. They respond to our inquiries within an hour. Server Intellect's customer support and assistance are the best we've ever experienced.

The front end Default.aspx page looks something like this:

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Using Performance Counters</title>
</head>

<body>
<form id="form1" runat="server">
<br />
<asp:Label ID="Label1" runat="server" Width="709px"></asp:Label>
<br />
<br />
<asp:Table ID="Table1" runat="server" Height="186px" Width="245px">
<asp:TableRow runat="server">
<asp:TableCell runat="server" Text="Propety" Width="50%" />
<asp:TableCell runat="server" Text="Value" Width="50%" />
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">ActiveControls:</asp:TableCell>
<asp:TableCell ID="ActiveControls" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">AOL:</asp:TableCell>
<asp:TableCell ID="AOL" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">BackgroundSounds:</asp:TableCell>
<asp:TableCell ID="BackgroundSounds" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">Beta:</asp:TableCell>
<asp:TableCell ID="Beta" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">Browser:</asp:TableCell>
<asp:TableCell ID="Browser" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">CDF:</asp:TableCell>
<asp:TableCell ID="CDF" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">Cookies:</asp:TableCell>
<asp:TableCell ID="Cookies" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">Crawler:</asp:TableCell>
<asp:TableCell ID="Crawler" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">EcmaScriptVersion:</asp:TableCell>
<asp:TableCell ID="EcmaScriptVersion" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">Frames:</asp:TableCell>
<asp:TableCell ID="Frames" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">JavaApplets:</asp:TableCell>
<asp:TableCell ID="JavaApplets" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">Win16:</asp:TableCell>
<asp:TableCell ID="win16" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">Version:</asp:TableCell>
<asp:TableCell ID="Version" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">VBScript:</asp:TableCell>
<asp:TableCell ID="VBScript" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">Win32:</asp:TableCell>
<asp:TableCell ID="win32" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">Type:</asp:TableCell>
<asp:TableCell ID="Type" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">Tables:</asp:TableCell>
<asp:TableCell ID="Tables" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">Platform:</asp:TableCell>
<asp:TableCell ID="Platform" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">MajorVersion:</asp:TableCell>
<asp:TableCell ID="MajorVersion" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">MinorVersion:</asp:TableCell>
<asp:TableCell ID="MinorVersion" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">MsDomVersion:</asp:TableCell>
<asp:TableCell ID="MsDomVersion" runat="server"></asp:TableCell>
</asp:TableRow>
</asp:Table>
</form>
</body>
</html>

Download the Full Working Version of this Project written with Visual Studio.NET C# 2005 Here!

Looking for the VB.NET 2005 Version? Click Here!

Looking for more ASP.NET Tutorials? Click Here!





 
  Developer Resources







Server Intellect Rocks