You must Sign In to post a response.
  • Category: ASP.NET

    Poll Question Restrict user submiting for then once

    Dear

    how to restrict user submiting poll more then once for anoymous user
  • #768140
    Hi,

    You can capture the user IPAddress and perform the operation. So only one person on one IP can poll the vote.
    Each user have each Session Id, we can capture that also and avoid the double voting.



    HttpContext.Current.Request.UserHostAddress;



    Authentication mechanism make it simple but as you mentioned it was anonymous user. We have only couple of options to restricts the user Session Id or IPAddress of the user.

    Thanks,
    Mani

  • #768144
    i tried but m geting same ipaddress

  • #768149
    As far as poll concerns IP address is the mail key when any user vote a poll you Should be easy enough to save the IPaddress to DB and check if IP already exists on each poll
    if any other user tried with the same IP then just throw the message ' Some one with this IP is already voted'
    otherwise it is really difficult to trace the number of attempt by anonymous user
    see below snippet to get IP address from client machine

    HttpContext.Current.Request.UserHostAddress;
    OR
    HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];

    hope it helps

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #768194
    Which, in the test environment does return the user IP addrress, but when we deploy the website to production, this variable has the IP of the server where the application is hosted. Any help?

  • #768200
    Hai Shaik Mohiuddin,
    I don't think that there are many options left for these kind of scenarios. Because if the user is not logged in to the website, ans they are anonymous users, it is hard to get the unique identity when polling the vote.
    The fewer options could be:
    1. Store the value in the Cookie so that when the user uses the same system and poll the vote, it should recognize that it is coming from the same system and same session using IP address.
    2. You can't rely alone on the IP address, because people can use dynamic IP address for the websites.
    3. You can give the option to user to quick sign-in using their Google/Facebook account. This option is used by many websites now a days which can solve the issue.
    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com


Sign In to post your comments