I want to know best practice on how to create Shopping cart using MVC 5 Owin Identity with support anonymous users.
Example: So both logged in and anonymous user can select products. For logged in user all is ok, I have userId and can create cart for him. What I must do for anonymous user? How I can create cart for him?
Please help.
Result of my investigation is so that it is bad to use Session with Owin & Identity.
http://brockallen.com/2012/04/07/think-twice-about-using-session-state
http://www.nsilverbullet.net/2014/06/24/tough-mvc-5-owin-external-authentication-issue/
My variant is to create temp cookie for shopping cart with cartId
.
When user logging in I'm checking if cookie for shopping cart exists and if so I attach all files to user cart. In other case I'm taking user cart id to cookie if cart id exists.