Get information from visitors...

S

Shapper

Hello,

I am adding a statistics section to my administration area and I need to
get information from my web site visitors when session starts. I know
this is done in glabal.asax.

My question is: how to get information from the web site visitors?

I would like to get some information like:
1. Country;
2. Os;
3. Time so I can determine how much time does the user spend in the web
site.

Is there some code or something like this in Asp.Net?

I want to get the data myself because I want to include all this in my
administration system so livestats and other products are not what I am
looking.

Thanks,
Miguel
 
C

Cathal Connolly [C# MVP]

you can use the request object to grab lots of information about visitors,
including browser type and useragent which will normally give enough info to
deduce OS, and of that information , see
http://msdn.microsoft.com/library/d...tml/frlrfsystemwebhttprequestmemberstopic.asp .

Country is a little harder. You can grab the users IP via
Request.UserHostAddress, and then do a reverse-DNS on that to work out what
RIPE block the IP is in. As RIPE block records are generally allocated to
countries this will give a 90%+ degree of accuracy. Theres a project on
codeproject that shows how to do this, or else download the dotnetnuke
portal (www.dotnetnuke.com), and take a look at the project in
controls\CountryListBox (it also ships with the necessary lookup file
GeoIP.dat in the data folder)

As for time, you could probably work it out via how long the users session
is active, but it's inaccurate, as they may have left the site before the
session times out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top