This generic voting poll web application tutorial was brought to you by
www.pcbutton.com - (2004 campaign buttons, political buttons
and memorabilia buttons)
What is a voting poll web application?
A voting pollweb application is a web page that
you can add to your website to allow users to
vote on stuff, chat about the poll�s candidates
and support their preferred choice in the voting poll.
Why add a voting poll to my website?
A voting poll like this will let you take statistics on
user choices, provide entertainment for your users
and even assist you in marketing products on your
website.
How to configure this voting poll for my own
elections on my website?
Simply edit vote.xml to hold information about your
voting poll:
<candidates>
<polltitle>2004 Presidential Campaign Voting Poll</polltitle>
<pollinstructions>Click on the candidate that you believe should be the next president of the United States of America.</pollinstructions>
<candidate>
name of a chatroom for candidate should
anyone decide to chat about this candidate.
Can be any IRC channel name that you can
think of without the '#' :
<chatroomname>SBT10027BUSH</chatroomname>
Picture of the candidate:
<image>SBT10027BUSH.jpg</image>
URL that the user may visit when they vote for this candidate:
<url>http:
Call the candidate something:
<candidatetitle>George W Bush</candidatetitle>
Store the IP address of each vote to prevent duplicate votes:
<votes>
<vote>192.168.0.77</vote>
<vote>192.168.0.71</vote>
</votes>
</candidate>
.
.
.
Note: Be sure to configure IIS to not allow users to
browse to vote.xml if you do not want it to be publicly available.
And you will need to grant ASP.NET write access to vote.xml:
1. Right-click vote.xml in explorer
2. Click "properties"
3. Click the "security" tab
4. Click "add" and add the ASPNET user
5. Highlight the ASPNET account
6. Check the "write" box in the "allow" column
Example application of this voting poll web application:
Here is an example application of this voting poll web application. In this case,
a poll of the 2004 elections is taken and lists some of the candidates:
After the user votes they receive confirmation of their vote and get
to see the status of all the candidates. They also get the option to
support their favorite candidate with a political campaign button, in
this example, from http://www.pcbutton.com/, or chat about the
candidate that they voted fore with other supporters:
What if someone votes twice?
After the user
If someone votes twice from the same IP address then his or her second vote will be rejected:
.
.
.
for(iAllVotes = 0;iAllVotes < pAllVotes.Count;iAllVotes++)
{
if(pAllVotes[iAllVotes].InnerText == strVoterId)
{
bChad = true;
}
}
if(!bChad)
{
.
.
.