Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: retrieving cookies


Message #1 by jmnamahoe@h... on Wed, 5 Jun 2002 10:55:51
i am able to add value to the cookie, but when i request the indiviual 
values of the cookie, i recieve error messages. however when i request the 
entire cookie and assign it to a label, the code runs fine. what do i need 
to do to be able to pull the individual records from the cookie, and 
display them in a label. currently the code looks like so:

piece of code sets the individual values to the cookie:

 Dim MyCookie as New system.web.HttpCookie("UserInfo")
     MyCookie.values.add("UsrEmail",ObjRead("UsrEmail"))
     MyCookie.values.add("UsrFname",ObjRead("UsrFname"))
     MyCookie.values.add("UsrLname",ObjRead("UsrLname"))
     Response.Cookies.Add(MyCookie)
     Response.Redirect("../FamilyTrax/Help.aspx")    

piece of code retrieves the values:

 Sub Page_Load (Source As Object, E as EventArgs)
 MyLabel.Text = Request.Cookies("UserInfo").Value
 Response.Cache.SetExpires(DateTime.Now)

note: i had the label try to retrieve the individual values like so:
mylabel.text = Request.cookies("userinfo").values("usremail")

but i receive the following error: identifier expected. any advise would 
be appreciated. 

  Return to Index