How to find user has voted.

264 views Asked by At

I am building a website. I want user to cast votes without login. But each user should allow only one vote for each question (similar to stack overflow voting system). I see somethig similar in urban dictionary (http://www.urbandictionary.com/) where you can cast votes without login. How to do this in ASP.NET MVC4?

I don't want to use cookies as someone can easily clear the cookies and vote again. How do you think http://www.urbandictionary.com/ is doing this?

2

There are 2 answers

2
Andrey Gubal On

I didn't try, but I suggest you may try to use Session for this porpose.

For example:

When user click on voute, set:

Session["isVouted"] = true

Now you may check: if((bool)Session["isVouted"]){don't allow to voute}. For better result you may set session time for one hour or one day.

0
Russ On

I don'h think this is going to be possible unless you have some sort of persistent storage. ie a db or cookies. The only down-side of cookies is that they can be cleared.