I get an error on my site that I donβt see in my Dev environment, and it seems to only happen with Chrome. I was looking a bit for a solution to this, and I only find problems with the Auth cookie. (In the past, I really raised the issue of chrome and the auth cookie), but that's different.
I store a basket of users in a cookie. I set the cookie this way
HttpCookie responseCookie = HttpContext.Response.Cookies[CartHelper.CART]; responseCookie.PackCartCookie(vm.Cart);
If the PackCartCookie extension method sets a cookie this way
cookie.Value = HttpUtility.UrlEncode(cookieValue);
This is the result of saving a cookie with the following settings
- Domain = www.foo.com
- RawSize = 230b
- Path = /
- Expires = Session
- HttpOnly = HttpOnly
- Value = Encryption
When a user interacts with the site, it seems that the Cart Cookie is being created, but from time to time it is lost or deleted. When I look at the Elmah error and look at the HTTP_COOKIE, I can see all the other cookies (I have others set in the same way, which function is fine), but I do not see the basket cookie.
I had to change the code to be more secure due to this problem. But, as you can imagine, the cookie cookie is used during the purchase process, and I did not manage when I respond to the purchase, where I accept payment, but the system crashes when the cart is gone and the user does not receive a notification of a successful purchase. Fortunately, I caught these early and returned users.
User agents where I saw the problem
- Mozilla / 5.0 (X11; Linux i686) AppleWebKit / 537.36 (KHTML, e.g. Gecko) Chrome / 29.0.1547.62 Safari / 537.36
- Mozilla / 5.0 (Windows NT 6.1; WOW64) AppleWebKit / 537.36 (KHTML, e.g. Gecko) Chrome / 29.0.1547.57 Safari / 537.36
- Mozilla / 5.0 (Windows NT 6.0) AppleWebKit / 537.36 (KHTML, e.g. Gecko) Chrome / 29.0.1547.62 Safari / 537.36
source share