I am working on a solution that consists of a Domain Model (in its separate project) and a MVC3 Web Application (again in its own project).
In my MVC3 application, I am listing posts (accessed via a Repository on the Domain), and each post has a like button, and of course in the Domain Model, the Post entity has a property of:
public int Likes { get; set; }
What I want to allow is for a visitor of my site (i.e. a guest) to be able to hit the Like button on a post, but only once. So that he/she is able to like a post once.
What is the best way of achieving this ? Cookies ? Saving IP Addresses in Database along with the Post Id liked ? Or some other way ?
I’m really confused, cause whichever way I think of, there are always holes in the logic, where a user can Like a post twice !
Any help would be great.
Thank You.
Have a loot at this Q&A: https://softwareengineering.stackexchange.com/questions/94095/how-to-prevent-same-user-rating-a-web-content-like-video-more-than-once
Bottom line: There is no way to absolutely prevent multi-votes, but you can partially mitigate the risk given enough development efforts.