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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thomaaxha
    New Member
    • Mar 2013
    • 16

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

    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 !!
  • pod
    Contributor
    • Sep 2007
    • 298

    #2
    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
    Last edited by pod; May 24 '13, 05:10 PM. Reason: typo

    Comment

    • thomaaxha
      New Member
      • Mar 2013
      • 16

      #3
      THanks for the answer , can you tell me how to track the client ip?

      Comment

      • pod
        Contributor
        • Sep 2007
        • 298

        #4
        With server variables; in your case request.serverv ariables("REMOT E_ADDR")

        Comment

        • thomaaxha
          New Member
          • Mar 2013
          • 16

          #5
          remote_adrr is my domain?!! and this variable i am gonna save to my db??

          Comment

          • pod
            Contributor
            • Sep 2007
            • 298

            #6
            If your website is behind a proxy server, the request.serverv ariables("REMOT E_HOST") might always return its IP (proxy server), in this case, check this link:
            I have the following code: string ip = Request.ServerVariables["REMOTE_ADDR"]; Which, in the test environment does return the user IP addrress, but when we deploy the website to production, this


            For future reference, here is a list of the ASP ServerVariables Collection:
            W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

            Comment

            • pod
              Contributor
              • Sep 2007
              • 298

              #7
              remote_adrr is the IP of the machine requesting a page from a web server

              Comment

              • thomaaxha
                New Member
                • Mar 2013
                • 16

                #8
                thanks to much :) ,, regards!!

                Comment

                • vijay6
                  New Member
                  • Mar 2010
                  • 158

                  #9
                  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.serverv ariables("REMOT E_ADDR")
                  Is this right?

                  Comment

                  • pod
                    Contributor
                    • Sep 2007
                    • 298

                    #10
                    "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
                    Last edited by pod; May 27 '13, 12:34 PM. Reason: clarifying and typo

                    Comment

                    • vijay6
                      New Member
                      • Mar 2010
                      • 158

                      #11
                      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?

                      Comment

                      Working...