Mario
Mario

Reputation: 14780

What method to use for voting in ASP.NET

I have many quotes on the website and I want user to be able to vote, Like or Unlike each quote. The problem is that if I save the voted info in a cookie, there is a 4kb limit and if there is a visitor which votes on 100 quotes it may exceed the cookie limit.

What is the best method to store the vote information for non logged users?

The votes are also stored in database, but without any user information saved. Only logged users have saved info for each vote.

Upvotes: 0

Views: 88

Answers (3)

Alex Pollan
Alex Pollan

Reputation: 873

You can save votes on a table with columns:

  • quoteid,

  • userguid (guid)

And set a cookie on nonregistered users browser with an assigned GUID

when a user visit your site check the user GUID or assign him a new one. This way you can block votes.

Upvotes: 1

Andrew Walters
Andrew Walters

Reputation: 4803

I would assign the non-logged in user a random ID and store this ID in the cookie.

The Id can then be used to reference data in your database.

Upvotes: 1

volpav
volpav

Reputation: 5128

You can use HTML5 Local Storage.

Upvotes: 1

Related Questions