How to set a cookie in client side a acces that in server side?

Hi,

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.


---------
Drudge
0
DRUDGE
12/30/2008 12:21:10 PM
asp.net.state-management 8807 articles. 0 followers. Follow

2 Replies
1322 Views

Similar Articles

[PageSpeed] 11

 To write -

        HttpCookie cookie = Request.Cookies["Language"];
        if (cookie == null)
        {
            cookie = new HttpCookie("Language");
        }

        cookie["lang"] = "Arabic";
        cookie.Expires = DateTime.Now.AddYears(1);
        Response.Cookies.Add(cookie);

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.

-Manas

=======================================
If this post is useful to you, please mark it as answer.
0
yeotumitsu
12/30/2008 2:09:05 PM

 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,

 

  Response.Write(Request.Cookies["nav"].Value.ToString());
 
  
Kumar Reddi
0
Kumar
12/30/2008 2:10:09 PM
Reply:

Web resources about - How to set a cookie in client side a acces that in server side? - asp.net.state-management

Cookie dough - Wikipedia, the free encyclopedia
Cookie dough refers to a blend of cookie ingredients which has been mixed into a malleable form which has not yet been hardened by heat . The ...

Facebook’s 2014 Game of the Year: Cookie Jam
C is for cookie, and it also stands for champion, as Cookie Jam from developer SGN was named “2014 Game of the Year” by Facebook. (more…) New ...

Tastemade - Cookie the News: David Bowie - Facebook
"I don't know where I'm going from here, but I promise it won't be boring." - David Bowie, 1947-2016

Facebook’s cookie-free targeting with Atlas: one step closer to Minority Report?
... movement another notch with the recent re-launch of Atlas , which boasts, amongst other things, the ability to target audiences without cookies. ...


Alasdair Cookie (@AlasdairStuart) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

How Proud Girl Scout Dad Chris Rock Got the Oscar Cookie Sale Started
The Girl Scouts selling cookies at the Oscars was indeed a real proud papa moment. During Sunday night's Academy Awards, host Chris Rock took ...

How Chris Rock Turned Girl Scout Cookies Into the Oscars' Biggest Brand Winner
... one expected that he would engineer the night's biggest, and sweetest, brand spotlight for one of the most high-profile Girl Scout cookie sales ...

Chris Rock raised $65K selling Girl Scout cookies for his daughters during the Oscars
Chris Rock sold $65,243 worth of Girl Scout Cookies during Sunday night's Oscars, hitting up his famous friends in the audience in order to help ...

Cops: Siblings robbed Girl Scout selling cookies
The Florida brother and sister duo allegedly stole a box of money from the table where a 12-year-old was selling the popular cookies outside ...

Resources last updated: 3/11/2016 5:39:44 PM