Cookies

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi
my question is if i have a way to change the value of a cookie that
i have created in the server with javascript in the client.
 
Diego,

I believe that you can do this by accessing the document.cookies collection
in javascript. There are many tutorials if you do a web search for it. I
have posted a link to one for you below.

If I have misunderstood your question please reply to this post so I may
better help.

I hope this helps.
 
hi brian

my problem is that i create a cookie on the server using
->this.Response.Cookies.Add(new HttpCookie("cookieName","cookieValue"));
but then i want to change the value of the cookie in the client using
javascript
registering this client script block
-><script language="javascript" type="text/javascript">
-> document.cookie = "cookieName= cookieNewValue";
-></script>
but it doesn´t work

Thanks Diego
 
Hi Diego,

I believe that you need to set the path to "/" for the cookie in the
javascript (e.g. document.cookie = "cookieName= cookieNewValue;path=/";

Please let me know if this works for you.

Hope this helps.
----------------------------
 
Back
Top