Click here to Skip to main content
16,007,885 members
Articles / Web Development / ASP.NET
Article

Generic Graphical Voting Poll Web Application

Rate me:
Please Sign up or sign in to vote.
2.58/5 (23 votes)
24 Feb 20042 min read 84.4K   1.6K   24   14
Generic voting poll web application for conducting polls from your website.

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://www.pcbutton.com/</url>

 


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:

 

 

Sample image

 

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:

 

Sample image

 

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)
{
.
.
.


 

 

 

 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
Keep on coding!

Comments and Discussions

 
GeneralMy vote of 5 Pin
dental implant23-Jul-23 6:17
professionaldental implant23-Jul-23 6:17 
QuestionHow can i use this with masterpage Pin
mtajuddin2-Apr-09 22:38
mtajuddin2-Apr-09 22:38 
Generalwhatever Pin
Anonymous8-Sep-04 4:35
Anonymous8-Sep-04 4:35 
GeneralRe: whatever Pin
frank63024-Dec-06 13:34
frank63024-Dec-06 13:34 
GeneralI need this for my site Pin
Anonymous20-Apr-04 10:29
Anonymous20-Apr-04 10:29 
GeneralRe: I need this for my site Pin
frank63024-Dec-06 13:36
frank63024-Dec-06 13:36 
GeneralHmmm... Pin
Anonymous3-Mar-04 10:19
Anonymous3-Mar-04 10:19 
GeneralNice! Pin
wahoot_19-Feb-04 8:37
wahoot_19-Feb-04 8:37 
Big Grin | :-D Big Grin | :-D Big Grin | :-D Big Grin | :-D
Nice! In 10 minutes I was able to reconfigure this and create a completely different voting poll for my website.
GeneralThanks Pin
Anonymous19-Feb-04 7:18
Anonymous19-Feb-04 7:18 
GeneralVERY COOL!! Pin
Anonymous19-Feb-04 7:17
Anonymous19-Feb-04 7:17 
QuestionWYSIWYG? Pin
Tomaž Štih18-Feb-04 22:01
Tomaž Štih18-Feb-04 22:01 
AnswerRe: WYSIWYG? Pin
Paul Selormey19-Feb-04 2:43
Paul Selormey19-Feb-04 2:43 
AnswerRe: WYSIWYG? Pin
leppie19-Feb-04 6:48
leppie19-Feb-04 6:48 
Generalleppie Pin
dzzxyz14-Apr-04 14:11
dzzxyz14-Apr-04 14:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.