JavaScript and ASP.NET - Cookies with Key / Value Pairs

Posted by user208662 on Stack Overflow See other posts from Stack Overflow or by user208662
Published on 2010-04-06T17:21:59Z Indexed on 2010/04/06 17:23 UTC
Read the original article Hit count: 201

Filed under:
|

Hello,

This question mixes client-side scripting with server-side parsing.

In some cases, I'm writing a cookie to the user's browser using the document.cookie property. In other cases, I'm writing the same cookie to the user's browser through the ASP.NET Response object.

When I'm writing the HttpCookie on the server-side, I am using the Values collection (http://msdn.microsoft.com/en-US/library/system.web.httpcookie.values%28v=VS.80%29.aspx) to store key/value pairs in the cookie. I would also like to be able to write key-value pairs to the cookie through JavaScript.

How do I create cookies with Key/Value pairs via JavaScript that ASP.NET can parse?

Thank you!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ASP.NET