TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Browser Information in ASP.NET
Pankaj Kumar
Aug 22, 2013
3.7
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
To get the details of running browser.
How to get All Browser information . for example -Firefox,IE,Google chrome etc.
If You are using Firefox then it will show Firefox Information only.
BrowserInformation.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="BrowserInformation.aspx.cs"
Inherits="BrowserInformation" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<fieldset style="width: 500px">
<legend>Browser Information</legend>
<table class="style1">
<tr>
<td>
<asp:Label ID="lblName" runat="server" Text="Browser Name:"></asp:Label>
</td>
<td>
<asp:Label ID="lblBrowserName" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblVersion" runat="server" Text="Browser Version:"></asp:Label>
</td>
<td>
<asp:Label ID="lblBrowserVersion" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblType" runat="server" Text="Browser Type:"></asp:Label>
</td>
<td>
<asp:Label ID="lblBrowserType" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblMajversion" runat="server" Text="Major version:"></asp:Label>
</td>
<td>
<asp:Label ID="lblMajorversion" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblMinVersion" runat="server" Text="Minor Version:"></asp:Label>
</td>
<td>
<asp:Label ID="lblMinorVersion" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblOs" runat="server" Text="Platform:"></asp:Label>
</td>
<td>
<asp:Label ID="lblPlatform" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblBetaVersion" runat="server" Text="Is Beta Version:"></asp:Label>
</td>
<td>
<asp:Label ID="lblIsBetaVersion" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblJScriptVersion" runat="server" Text="Java Script Version:"></asp:Label>
</td>
<td>
<asp:Label ID="lblJavaScriptVersion" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblSupportjavascript" runat="server" Text="Supports javascript?:"></asp:Label>
</td>
<td>
<asp:Label ID="lblSupportsjavascript" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblbrowsersupportcookies" runat="server" Text="Does browser support cookies?:"></asp:Label>
</td>
<td>
<asp:Label ID="lblDoesbrowsersupportcookies" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblSearchwebcrawler" runat="server" Text="Search engine web crawler?:"></asp:Label>
</td>
<td>
<asp:Label ID="lblSearchenginewebcrawler" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblmobilebrowser" runat="server" Text="Is this a mobile browser?:"></asp:Label>
</td>
<td>
<asp:Label ID="lblIsthisamobilebrowser" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblActivecontrolsenabled" runat="server" Text="ActiveX controls enabled?:"></asp:Label>
</td>
<td>
<asp:Label ID="lblActiveXcontrolsenabled" runat="server"></asp:Label>
</td>
</tr>
</table>
</fieldset>
</form>
</body>
</html>
BrowserInformation.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
HttpBrowserCapabilities objBrwInfo = Request.Browser;
lblBrowserName.Text = objBrwInfo.Browser;
lblBrowserVersion.Text = objBrwInfo.Version;
lblBrowserType.Text = objBrwInfo.Type;
lblMajorversion.Text = objBrwInfo.MajorVersion.ToString();
lblMinorVersion.Text = objBrwInfo.MinorVersion.ToString();
lblPlatform.Text = objBrwInfo.Platform.ToString();
lblIsBetaVersion.Text = objBrwInfo.Beta.ToString();
lblJavaScriptVersion.Text = objBrwInfo.EcmaScriptVersion.ToString();
lblSupportsjavascript.Text = objBrwInfo["JavaScript"].ToString();
lblDoesbrowsersupportcookies.Text = objBrwInfo.Cookies.ToString();
lblSearchenginewebcrawler.Text = objBrwInfo.Crawler.ToString();
lblIsthisamobilebrowser.Text = objBrwInfo.IsMobileDevice.ToString();
lblActiveXcontrolsenabled.Text = objBrwInfo.ActiveXControls.ToString();
}
Browser Information in ASP.NET
Next Recommended Reading
Get Unique Browser Id For All Tabs In ASP.NET