Reputation: 34150
Browser confirms that both curvlist
and guestuser
cookies exist. However When I get the guestuser
it has the correct value:
string Guest = Request.Cookies["guestuser"];
but the cookie curvlist
is empty:
The only difference is that guestuser
is created in server side, but curvlist
created by javascript. But it has nothing to to with reading the cookies
Upvotes: 0
Views: 554
Reputation: 146
CookieManager: ASP.Net Core Abstraction layer on top of HTTP Cookie . ASP.NET Core Wrapper to read and write the cookie. it has fluent apis and ease of use.
https://github.com/nemi-chand/CookieManager
Silent features:
Have a look
Upvotes: 0
Reputation: 34150
Experimenting different values for the cookie, I found out something that is very stupid (correct me if I'm wrong): Apparently cookie name and value is separated by comma so having commas in the value would lead loss of the rest of the value after comma (in my case starting with comma would lead to empty value). I changed the separator in cookie to $
instead of ,
and now I'm getting the correct value.
But why Asp.net reads cookies this way? (Note that there was no problem when reading cookies with comma separated values in the javascript .
Upvotes: 1