Updating cookie erases previously set values
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngfreeforall' list.


Casella Ii, Cono
Hi-
I'm setting a cookie as follows:
1: Dim ckCA As New HttpCookie("ckCA")
2: ckCA.Values.Add("ID", CType(m_Prof_ID.ToString, String)) 'm_Prof_ID
is a Guid from a SQL query
3: ckCA.Values.Add("URL", HttpContext.Current.Request.RawUrl)
4: HttpContext.Current.Response.Cookies.Add(ckCA)

Then, I update the ("URL") key in another page:

1: HttpContext.Current.Response.Cookies("ckCA").Values("URL") HttpContext.Current.Request.RawUrl

However, after this, the ("ID") key's value I set upon first creating
the cookie is erased. How can I update one key's value without erasing
the other(s)?

Cono Casella
Computer Associates
Programmer
tel: +1 631 342 6568
fax: +1 631 342 6884
Click here to reveal e-mail address
Reply to this message...
 
    
Suren
Messagetry this

Request.Cookies("ckCA").Values("URL") = HttpContext.Current.Request.RawUrl

----- Original Message -----
From: Casella Ii, Cono
To: aspngfreeforall
Sent: Thursday, August 15, 2002 12:02 PM
Subject: [aspngfreeforall] Updating cookie erases previously set values

Hi-
I'm setting a cookie as follows:
1: Dim ckCA As New HttpCookie("ckCA")
2: ckCA.Values.Add("ID", CType(m_Prof_ID.ToString, String)) 'm_Prof_ID is
a Guid from a SQL query
3: ckCA.Values.Add("URL", HttpContext.Current.Request.RawUrl)
4: HttpContext.Current.Response.Cookies.Add(ckCA)

Then, I update the ("URL") key in another page:

1: HttpContext.Current.Response.Cookies("ckCA").Values("URL") HttpContext.Current.Request.RawUrl

However, after this, the ("ID") key's value I set upon first creating the
cookie is erased. How can I update one key's value without erasing the
other(s)?

Cono Casella
Computer Associates
Programmer
tel: +1 631 342 6568
fax: +1 631 342 6884
Click here to reveal e-mail address

| ASP.net DOCS = http://www.aspng.com/docs | [aspngfreeforall] member
Click here to reveal e-mail address = YOUR ID | http://www.asplists.com/aspngfreeforall = JOIN/QUIT
| news://ls.asplists.com = NEWSGROUP
Reply to this message...
 
 
System.Web.HttpContext
System.Web.HttpCookie




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com