Geekpedia Programming Tutorials






Sniffing visitor information

Collecting lots of browser information from the visitor with VB .NET in ASP .NET.

On Saturday, June 5th 2004 at 10:54 AM
By Andrew Pociu (View Profile)
*****   (Rated 4.3 with 17 votes)
Contextual Ads
More ASP.NET Resources
Advertisement

Any website that generates a decent traffic needs a statistic page. So how do you collect statistics?
ASP .NET knows how to sniff some information from the visitor, from basic information like the browser version to information about the support of Java Applets and ActiveX Controls.

The following is VB .NET code for displaying client information with ASP .NET:


<%
response.write("<b>Name:</b> " & Request.ServerVariables("REMOTE_HOST") & "<br />")
response.write("<b>IP:</b> " & Request.ServerVariables("REMOTE_ADDR") & "<br />")
response.write("<b>User agent:</b> " & Request.ServerVariables("HTTP_USER_AGENT") & "<br />")
response.write("<b>Language:</b> " & Request.ServerVariables("HTTP_ACCEPT_LANGUAGE") & "<br />")
response.write("<b>Browser:</b> " & Request.Browser.Browser & "<br />")
response.write("<b>Type:</b> " & Request.Browser.Type & "<br />")
response.write("<b>Version:</b> " & Request.Browser.Version & "<br />")
response.write("<b>Major version:</b> " & Request.Browser.MajorVersion & "<br />")
response.write("<b>Minor version:</b> " & Request.Browser.MinorVersion & "<br />")
response.write("<b>Beta:</b> " & Request.Browser.Beta & "<br />")
response.write("<b>Cookies:</b> " & Request.Browser.Cookies & "<br />")
response.write("<b>Frames:</b> " & Request.Browser.Frames & "<br />")
response.write("<b>Tables:</b> " & Request.Browser.Tables & "<br />")
response.write("<b>ActiveX:</b> " & Request.Browser.ActiveXControls & "<br />")
response.write("<b>Java Applets:</b> " & Request.Browser.JavaApplets & "<br />")
response.write("<b>JavaScript:</b> " & Request.Browser.JavaScript & "<br />")
response.write("<b>VBScript:</b> " & Request.Browser.VBScript & "<br />")
response.write("<b>Platform:</b> " & Request.Browser.Platform & "<br />")
response.write("<b>Crawler:</b> " & Request.Browser.Crawler & "<br />")
%>


Here is a sample result:

Name: geekpedia
IP: 127.0.0.1
User agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 1.0.3705)
Language: en-us
Browser: IE
Type: IE6
Version: 6.0
Major version: 6
Minor version: 0
Beta: False
Cookies: True
Frames: True
Tables: True
ActiveX: True
Java Applets: True
JavaScript: True
VBScript: True
Platform: WinXP
Crawler: False
Digg Digg It!     Del.icio.us Del.icio.us     Reddit Reddit     StumbleUpon StumbleIt     Newsvine Newsvine     Furl Furl     BlinkList BlinkList

Rate Rate this tutorial
Comment Current Comments
by mohan raja on Sunday, November 18th 2007 at 07:54 AM

Very good, It\'s useful for me to find user\'s info..


Comment Comment on this tutorial
Name: Email:
Message:
Comment Related Tutorials
There are no related tutorials.

Comment Related Source Code
There is no related source code.

Jobs ASP.NET Job Search
My skills include:
Enter a City:

Select a State:


Advanced Search >>
Latest Tech Bargains

Advertisement

Free Magazine Subscriptions

Today's Pictures

Today's Video

Other Resources

Latest Download

Latest Icons