For whatever reason, there is this huge fear among users that they will be personally identified and watched based on their behavior. It is indeed possible to track behavior, but to personally identify is impossible if you never tell the site who you are. We would not have half of the problems with privacy that we have if Web sites would be open and honest about what they do with visitor information. Just tell the people that you are going to use a cookie to make sure that they do not vote twice and provide them with a way of obtaining more information about cookies and how you intend to respect their privacy. Seems I found that soapbox again.
Cookies are easy to set up, so let's do that first.
The code shown above sets up a cookie called PollCookie, using the ASP Cookies Collection. The first line sets up the expiration date of the cookie to today's date plus 365 days - or one year. The second line tells the cookie what domain name or IP, etc. for which it is being stored. PollID sets an attribute of the cookie, named PollID equal to the ID of the poll displayed on the Web page. Where the code actually goes is also pretty easy, it should go right after the code that updates the database, but still inside the if statement.