Retrieve browser details using C#.Net

This C#.Net tutorial explains, how to get browser details like browser name, browser version, etc using C#.Net.

Retrieve browser details using C#.Net

C#.Net provides HttpBrowserCapabilities class to interact with browser properties. This class present in System.Web namespace. So before using the HttpBrowserCapabilities we need to import the namespace.

Full code:

lblBrowserDetails.Text = “Browser name: ” + Request.Browser.Browser
+ ” Browser Type: ” + Request.Browser.Type
+ ” Browser Version :” + Request.Browser.Version
+ ” Browser Major Version: ” + Request.Browser.MajorVersion
+ ” Browser Minor Version: ” + Request.Browser.MinorVersion
+ ” Is Browser in Beta version? ” + Request.Browser.Beta;

The output will be like below:

Internet Explorer:
Browser name: IE Browser Type: IE8 Browser Version: 8.0 Browser Major Version: 8 Browser Minor Version: 0 Is Browser in Beta version? False

Mozilla Firefox:
Browser name: Firefox Browser Type: Firefox15 Browser Version: 15.0 Browser Major Version: 15 Browser Minor Version: 0 Is Browser in Beta version? False

Google Chrome:
Browser name: Chrome Browser Type: Chrome21 Browser Version: 21.0 Browser Major Version: 21 Browser Minor Version: 0 Is Browser in Beta version? False

You may like following C#.Net tutorials:

Hope this C#.net tutorial explains how to get browser details like browser name, browser version, etc using C#.Net.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

>