we have to build a functionality in asp.net and c# which in a online survey one ip address will only be allowed to attend the survey once? how can we achieve this?
Asked
Active
Viewed 388 times
0
-
1I believe it is bad idea... But please clarify your question. It is not clear what your problem is currently - storing requesting IP in a database should not be that hard... – Alexei Levenkov Aug 17 '13 at 08:10
-
1possible duplicate of [How to get a user's client IP address in ASP.NET?](http://stackoverflow.com/questions/735350/how-to-get-a-users-client-ip-address-in-asp-net) – kbvishnu Aug 17 '13 at 08:13
-
@User1673394, please check the above question for more details – kbvishnu Aug 17 '13 at 08:14
-
Note that various ISP use NAT, so their users are all behind few IP Addresses. Cellular Networks nearly always use NAT. – xanatos Aug 17 '13 at 08:26
-
I think using only IP address is bad idea as their could be many user using a single proxy server and having same IP address. A combination of IP address and cookie could be a solution, but again there is no bullet proof solution. – Taimur Khan Aug 17 '13 at 08:46
-
I would look into browser fingerprinting instead. – ghord Aug 17 '13 at 08:58
-
possible duplicate of [How to make sure a user can only vote once on an ASP.NET poll](http://stackoverflow.com/questions/522871/how-to-make-sure-a-user-can-only-vote-once-on-an-asp-net-poll) – Aristos Aug 17 '13 at 09:31
1 Answers
1
Try this to get IP
HttpContext.Current.Request.UserHostAddress;
or
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
or
HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
Store some where in database..now for every time on Request for survey you can lookup in database that it is exist or not

sangram parmar
- 8,462
- 2
- 23
- 47