Click here to Skip to main content
15,895,656 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
sir please give me answer very soon
Posted
Comments
Thanks7872 2-Sep-14 1:31am    
What do you mean by identify here?

You can do the following:

When an unauthenticated user adds the first item to his cart, assign it an unique id.
Store that id in a cookie
Save in your database the change made to the cart, using that id as a primary key.
When the session times out:

Read from the cookie the value previously assigned to the user's cart
Restore the cart for the current session from the data stored in the database.
There is a downside:

Suppose you have stored an user's cart in a db, and the user never comes back. In this case you'll want to implement a cleanup policy, say, cart are stored for two weeks max.
This can happen also when the user clean his browser's cache
Take into account that a user can browse your site with different browsers (and thus, different caches/cookies)
 
Share this answer
 
Comments
Thanks7872 2-Sep-14 1:31am    
And suppose 15lakhs customers visited the site in a week. So db have to store that records. Bad idea.
Gihan Liyanage 2-Sep-14 1:36am    
Mm yes may be, Thats why I indicated Downsides of the idea. Any way he can select the option according to the site traffic. Thank for giving the advice. :)
Hi,

Cookie [^]would be a option for you.

Take email id from user and save it in cookie. ( very common )

Each time anonymous request comes to server check whether that request contains any cookie or not.
if not then create a Guid (or may create your own unique id) and send it in encrypted format by adding that cookie to your response. If your request have a cookie then check the value is proper or not.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900