How do I know if a site user is unique or a recurring user in ASP.NET?

One user can appear as multiple unique users during a specific period of time when they display the site. The user's private IP address is static, but on the network the user is represented by the IP address of the ISP's router, right?

0


a source to share


2 answers


You cannot guarantee that a user is unique by IP address.

Companies can run behind a firewall / proxy server, so all requests will come from the same IP address.

Probably the best option would be to reset the cookie to the user's browser when they visit the site, and then check for that cookie on subsequent visits.



But even this does not guarantee that you have nothing to do so that the user does not clear their cookies in the browser or visit once from IE, and the next time from firefox.

In a nutshell, there is no guaranteed way ... but there are ways to make a pretty good guess

+4


a source


For each customer that comes to your site, assign a unique ID to them and save it in a cookie. Then check that cookie every time your site is hit and set it if it's missing. You can then register the use of the client by the unique ID.

Usually the IP address you see on the client is the IP address provided to it by the client. They are often dynamic. Clients behind proxies and routers will use IP addresses. Either way, assigning a unique cookie to each client bypasses these issues.



It will not work for disabled cookies. You will have to provide the default IP address for these users and risk incorrect data. Or you can simply not register such a user, in which your data will be incomplete. There is no reliable way to uniquely differentiate between each user, so you just have to choose which method is most appropriate for your site.

+2


a source







All Articles