Getting Internet Explorer Version using C#

Most of the time we may need to get the version of Interet Explorer in web application using c#.

Let's have a look over below mentioned code to get the Internet Explorer's version in c#.

public partial class mywebpage : System.Web.UI.UserControl
{
private float gettingInternetExplorerVersion()
{
// Will the version of IE or a -1 indicating the use of another browser.

float rva = -1;
System.Web.HttpBrowserCapabilities browser = Request.Browser;
if (browser.Browser == "IE")
rva = (float)(browser.MajorVersion + browser.MinorVersion);
return rva;
}
protected void Page_Load(object sender, EventArgs e)
{
double ver = gettingInternetExplorerVersion();
Label1.Text = ver;
}
}

so this is the way to get the Internet Explorer version in C#

0 comments: