By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,902 Members | 1,268 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,902 IT Pros & Developers. It's quick & easy.

how to allow to vote only once by controlling client IP in my poll website with c#?

P: 16
Hello i am creating a poll website to vote for some projects but i want to prevent voting more than only one time and i want to control it by client IP .. do you have any idea?? thnks , regards !!
May 24 '13 #1

✓ answered by pod

If your website is behind a proxy server, the request.servervariables("REMOTE_HOST") might always return its IP (proxy server), in this case, check this link:
http://stackoverflow.com/questions/6...-the-server-ip

For future reference, here is a list of the ASP ServerVariables Collection:
http://www.w3schools.com/asp/coll_servervariables.asp

Share this Question
Share on Google+
10 Replies


pod
100+
P: 298
pod
If you can capture the client IP as they click to vote, then in your code logic follow these steps:
  1. check the data table for the client IP
  2. if it exists return a message that they already voted
  3. else insert the client IP into the data table and return an acknowledgement message
May 24 '13 #2

P: 16
THanks for the answer , can you tell me how to track the client ip?
May 24 '13 #3

pod
100+
P: 298
pod
With server variables; in your case request.servervariables("REMOTE_ADDR")
May 24 '13 #4

P: 16
remote_adrr is my domain?!! and this variable i am gonna save to my db??
May 24 '13 #5

pod
100+
P: 298
pod
If your website is behind a proxy server, the request.servervariables("REMOTE_HOST") might always return its IP (proxy server), in this case, check this link:
http://stackoverflow.com/questions/6...-the-server-ip

For future reference, here is a list of the ASP ServerVariables Collection:
http://www.w3schools.com/asp/coll_servervariables.asp
May 24 '13 #6

pod
100+
P: 298
pod
remote_adrr is the IP of the machine requesting a page from a web server
May 24 '13 #7

P: 16
thanks to much :) ,, regards!!
May 24 '13 #8

100+
P: 158
If you can capture the client IP as they click to vote, then in your code logic follow these steps:

1. check the data table for the client IP
2. if it exists return a message that they already voted
3. else insert the client IP into the data table and return an acknowledgement message
Hey pod, i've some doubts!!! What will happen if the ISP of the client allocates dynamic IP for the client whenever client connects to the internet?

With server variables; in your case request.servervariables("REMOTE_ADDR")
Is this right?
May 27 '13 #9

pod
100+
P: 298
pod
"What will happen if the ISP of the client allocates dynamic IP for the client whenever client connects to the internet?"
You are right vijay6 it is a good concern but one would have to turn off and on their modem and hope to get a different IP just to vote again. My ISP allocates dynamic IP addresses as well, and I do not know if it is the same for most ISP but in over 10 years I think my IP address changed three or four times...but then again my modem is always on.


So you brought a valid point, and there are other methods to consider:

One could to try to capture the MAC Address of the user, but that can be falsified as well.
Cookies is another way, but cookies can be deleted.
Getting voters to register and login before voting, but again one can register multiple times.

There is a lot to consider but for the sake of simplicity I think this is good enough for the purpose of a poll (unless of course you are electing a new president :)


There is probably a better way to do this that someone knows out there but that was my two cents

P:oD

p.s.
cool name "vijay6", you should get a proper avatar
May 27 '13 #10

100+
P: 158
Hey pod, whatever method we use we can't stop fraud vote for this scenario but we can reduce it. By capturing few more informations. Like what you said by capturing IP address, Mac address and Login & Vote, we can reduce it.

you should get a proper avatar
Why don't you suggest a proper avatar for me?
May 28 '13 #11

Post your reply

Sign in to post your reply or Sign up for a free account.