I have used [document.cookie = 'nav=another test; expires=Fri, 3 Aug 2009 20:47:11 UTC; path=/' ] the code enclosed in bracket to set the cookie in the client side. However if i try to access the same in the code file, the value comes as blank.
Please guide me how to set it in client side and access in server side.
To write -
HttpCookie cookie = Request.Cookies["Language"];
if (cookie == null)
cookie = new HttpCookie("Language");
cookie["lang"] = "Arabic";
cookie.Expires = DateTime.Now.AddYears(1);
To read -
HttpCookie cookie = Request.Cookies["UaeLpLanguage"];
string pageUrl = Request.Url.ToString();
if (cookie != null)
if (cookie.Value.ToString() == "English")
// ur operation
Hope it helps.
If this post is useful to you, please mark it as answer.
You Should be able to access it on the server side.. Make sure you are trying to read the Request collection, not the Response cookie collection.. For example, the cookie you mentioned can be read and printed as,