This took me some time:


When you use client-side code (the Document.Cookie property) to write cookies, and then use the same method to retrieve the cookies, you may receive an empty string or the following error message:

From here.
So, I guess, better don't use JavaScript setcookie, rather use server - side setting cookies.