I want to record all the user that browse into my web site, in order to store IP address. I already record the user that log in to my website, but for the user that not log in, I really have no idea how
Asked
Active
Viewed 209 times
0
-
Is this webforms or mvc? Do you want to do server side logging or could it just be something like Google Analytics that uses javascript. – Brandon Joyce Dec 28 '11 at 08:00
-
@Brandon Joyce : It is asp.net MVC with c# – Nothing Dec 28 '11 at 08:01
-
1@socheata - Have you tried http://www.sharpcrafters.com/postsharp/ ? and have a look at http://stackoverflow.com/questions/1945122/asp-net-user-activity-tracking-in-database – KV Prajapati Dec 28 '11 at 08:13
2 Answers
1
You can use a either a third party analytics tools such as Google Analytics. OR you can grab the client's IP address according to this article [ How to get a user's client IP address in ASP.NET? ] and store it in a database.

Community
- 1
- 1

Ranhiru Jude Cooray
- 19,542
- 20
- 83
- 128
-
I know how to get the IP address of the clients, but I don't know which point that I can record it. I mean, if user that ready log in , I can record it in ValidateCustomer() model. So for the user that not log in, where can I record it? – Nothing Dec 28 '11 at 08:04
-
Add it as first step in your ValidateCustomer action. Any request that is coming should be logged first. – Anand Dec 28 '11 at 08:16
0
You can log IP address and browser information in "Session_Start" in Global.asax.cs which fires every time a new user session is start. If user already logged-in then you can skip the log.

Mahesh
- 1,754
- 7
- 36
- 54
-
This only start this session while the user log in not for the normal user that not yet log in. – Nothing Dec 29 '11 at 03:22