Search - Articles - Dev Forums - Favorites - Member Login
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009


Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

Build the right apps the right way with powerful development tools.
Visual Studio 2010. Learn more...
Get Browser Detail of Client Using C#

Author: DevASP
Download Source Code : 471_GetBrowserDetail.zip

In this article I will try to explain you how you can get the IP Address of the client and see its Browser Details using ASP.Net and C#.

Create a new asp.net application using C# and add label control and a button on the from. Set the following text to the button:

Your IP Address / Hostname , Your IP Address , Your Hostname , Browser/Computer Properties , Browser , Cookies Enabled , Frames Enabled , Time and Date , JavaApplets Enabled , JavaScript Enabled , Major Version , Minor Version , Platform , Version , ActiveX Controls Enabled , Support Background Sounds , .net Runtime Version.

Now write the following code on the button click event:

private void Button1_Click(object sender, System.EventArgs e)

{

l17.Text += System.DateTime.Now ;

l1.Text += Request.UserHostAddress;

l2.Text += Request.UserHostName;

l3.Text += Request.Browser.Browser;

if (Request.Browser.Cookies)

l4.Text += "Enabled";

else

l4.Text += "Disabled";

if (Request.Browser.Frames)

l5.Text += "Enabled";

else

l5.Text += "Disabled";

if(Request.Browser.JavaApplets)

l6.Text += "Enabled";

else

l6.Text += "Disabled";

if(Request.Browser.JavaScript)

l7.Text += "Enabled";

else

l7.Text += "Disabled";

l8.Text += Request.Browser.MajorVersion ;

l9.Text += Request.Browser.MinorVersion ;

l10.Text += Request.Browser.Platform ;

if(Request.Browser.Tables)

l11.Text += "Enabled";

else

l11.Text += "Disabled";

l12.Text += Request.Browser.Type ;

if(Request.Browser.VBScript)

l13.Text += "Enabled";

else

l13.Text += "Disabled";

l14.Text += Request.Browser.Version ;

if(Request.Browser.Win16)

l15.Text += "Enabled";

else

l15.Text += "Disabled";

if(Request.Browser.Win32)

l16.Text += "Enabled";

else

l16.Text += "Disabled";

if(Request.Browser.ActiveXControls)

l18.Text += "Enabled";

else

l18.Text += "Disabled";

if(Request.Browser.BackgroundSounds)

l19.Text += "Yes";

else

l19.Text += "No";

l20.Text += Request.Browser.ClrVersion.ToString();

}

Article Comments
Yup, i tried this code, it is working..thanks!

Posted on 11/19/2008 8:20:13 AM by Abhishek Mishra

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< Block Navigation and Other Option on Web Page Using JavaScript

Disclaimer - Privacy
© 2002-2010 DevASP.net