Reputation: 101
On my site i have used cookie to store few details in browser.
The issue is, it doesn't store value which ends with ampersand. i.e. HiAll655& loads back as HiAll655
I found that cookie creates issue with few characters like ampersand but it stores & loads value like HiAll655&HiAll properly.
Any help would be appreciated.
Thank you
Upvotes: 1
Views: 904
Reputation: 8417
You can use HttpUtility.UrlEncode(string)
when storing the value, and HttpUtility.UrlDecode(string)
when reading the value.
UrlEncode
transforms &
to %26
which is safe to use in cookies.
Upvotes: 3