title: Cart lifecycle with cookie
body: <p>I have an implementation Of the cart that is using Session and want to migrate to a cookie based one. Moreover actually I am storing the complete cart in the session and want to migrate to a version where only the cartID is in the cookie while the content is in a database.</p>
  
  <p>I have read many blog posts and even questions on SO but still have some confusion on some area:</p>
  
  <ul>
  <li>how is the cookie lyfecycle? Actually I create a new cart when a new session begins. Then I manage the session based on customer action (add to cart, remove from cart, clear on checkout)</li>
  <li>how can I create a unique cookieId </li>
  <li>which is the best way to handle the backing to database task? Using jQuery or it is better to handle everything server side?</li>
  </ul>
  
  <p>For instance I am using asp net mvc with c#.</p>