Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cookies on server side not accurate 1

Status
Not open for further replies.

fldbryan

Programmer
Jan 22, 2004
46
US
I am converting an application from asp to asp.net involving cookies. I save the cookie on the client side and then access it later from the server. This has always worked fine under asp. With asp.net I am running into a problem where the hex codes are not translating back into text. Here's an example:

Stored by client:
This is where skills go

Retrieved by server:
This%20is%20where%20skills%20go

Does anyone have a method for converting it back to the original text?

Thanks
 
Try using Server.UrlDecode to restore the original text.

[yawn] [morning] [yawn]
 
To answer your question about restoring your original text:
Code:
Server.UrlDecode(Request.Cookies("myCookie").Value)
To give you an simple example about managing cookies:
Code:
Creating a cookie:
Dim myck As HttpCookie = New HttpCookie("myCookie")
myck.Value = "This is where skills go"
myck.Expires = Now.AddDays(2)
Response.Cookies.Add(myck)

Reading a cookie:
Request.Cookies("myCookie").Value

Deleting a cookie:
Response.Cookies("myCookie").Expires = Now

I hope this helps!

[yawn] [morning] [yawn]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top