I was able to save and read cookie using -Request.Cookies - in IE and FireFox. But I could not read in Chrome. It is always null. The following is my code to save and read the cookie:
If it does not save only in Chrome, then it's a browser setting that prevents the cookie from saving.
Go to the setting in Google Chrome. It will open up a new tab. From there, click "Under the Hood". Under the "Content Settings", you will see a sub category,
Cookies. From the radio button list, choose Allow local data to be set (recommended). And also make sure you have unchecked "Block third-party cookies and site data".
touraine
Member
85 Points
22 Posts
cookie in google chrome
Apr 29, 2012 02:44 AM|LINK
Hi,
I was able to save and read cookie using -Request.Cookies - in IE and FireFox. But I could not read in Chrome. It is always null. The following is my code to save and read the cookie:
//Save
HttpCookie test= new HttpCookie("data");
test.Values["Name"] = "hello";
//Read
if (Request.Cookies["data"] != null)
txtNm.Text = Server.HtmlDecode(Request.Cookies["data"]["Name"].ToString());
Can someone help me?
Thanks!
chiragtoad
Member
212 Points
51 Posts
Re: cookie in google chrome
Apr 29, 2012 05:45 AM|LINK
check this link this may help you out
https://support.google.com/chrome/bin/answer.py?hl=en&answer=95647&p=cpn_cookies
ramiramilu
All-Star
97923 Points
14516 Posts
Re: cookie in google chrome
Apr 29, 2012 10:19 AM|LINK
check your google chrome settings....
Thanks,
JumpStart
Ruchira
All-Star
44342 Points
7194 Posts
MVP
Re: cookie in google chrome
Apr 29, 2012 10:56 AM|LINK
Hello,
If it does not save only in Chrome, then it's a browser setting that prevents the cookie from saving.
Go to the setting in Google Chrome. It will open up a new tab. From there, click "Under the Hood". Under the "Content Settings", you will see a sub category, Cookies. From the radio button list, choose Allow local data to be set (recommended). And also make sure you have unchecked "Block third-party cookies and site data".
Try again. Now it will work.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.touraine
Member
85 Points
22 Posts
Re: cookie in google chrome
Apr 29, 2012 02:17 PM|LINK
Thank you all for replying. I have already did what you have suggested but it still does not work.
Ruchira
All-Star
44342 Points
7194 Posts
MVP
Re: cookie in google chrome
Apr 29, 2012 02:24 PM|LINK
Hi,
It's strange. I suspect your Chrome installation is not stable. Can you reinstall it or can you check it on another PC?
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.touraine
Member
85 Points
22 Posts
Re: cookie in google chrome
Apr 29, 2012 02:35 PM|LINK
I also tried on another pc with Windows XP and Windows 7. Uninstall Chrome on both and reinstall but still the same. That's really strange. :-(
Richey
Contributor
3816 Points
431 Posts
Re: cookie in google chrome
May 04, 2012 01:30 PM|LINK
Hi,
The problem may be due to your don't enable cookie in Google Chrome. You can enable cookie in chrome with the below link.
http://support.google.com/accounts/bin/answer.py?hl=en&answer=61416
http://www.chromefans.org/chrome-tutorial/how-to-manage-cookies-data-in-google-chrome.htm