Reputation: 9637
I have a program that writes in the cookie on a page, the redirect,
SetCookie(key,value);
Response.Redirect("SecondPage.aspx");
and tries to read the cookie on the second page.
var value = GetCookie(key);
As simple as that! It works fine on IE/FF/Chrome, but not in Apple's Safari!
This is how the cookie value looks line in IE/FF/Chrome:
flyerName=1111+test+road%2c+LS%2c+MO&flyerPersonId=1241BST34&flyerTemplate=Vertical.pdf&flyerListing=6666&flyerOrg=TESTORG
and in Safari:
flyerName=1111+test+road
apparently Safari has truncated the string after %2C which is comma(,) in ascii table!
P.S. I've seen this post, but it didn't help me.
Upvotes: 1
Views: 1765
Reputation: 9637
Problem solved! Before saving cookie, do a Server.UrlEncode(strValue)
and when retrieving that used a Server.UrlDecode(c.Values.Item(strKey))
Apparently Safari cannot handle the ","
and ";"
correctly in cookie value.
Upvotes: 2
Reputation: 1697
Try this
Responce.cookie["PageUrl"].value=your value;
Responce.cookie["PageUrl"].Path="/";
now you can access this cookie throught out you application;
Upvotes: 0