Cast from type 'HttpCookie' to type 'String' is not valid


Hi.
I am currently storing data in a cookie (an ID from a database) which i then want to retrieve and use to generate a file name for an uploaded file later on, which will be stored on disk.
I get the error "Cast from type 'HttpCookie' to type 'String' is not valid". I assume i need to find a way to convert the data to string?
A little help pleeeze, code examples too ;-)
0
consilio
9/28/2003 2:11:31 AM
asp.net.web-forms 93655 articles. 6 followers. Follow

2 Replies
803 Views

Similar Articles

[PageSpeed] 22


Sounds like you may have missed specifing the value property.
If you're trying to get the value into a string variable, for instance, something like this:
(VB)
Dim var As String
var = Request.Cookies("myCookie").Value
Regards,
Xander
0
Xanderno
9/28/2003 5:10:24 AM
i realize that this is an older post, but i found some info on here that was useful, and i wanted to post a follow up question.

when i enter the code as listed above and write out the contents of the var string, i get the following:
9A5C7D94701396821FA7628C215BFF2A2ED73887181EC4ECDAA2AD9D8538C33AFD7C7AB08EF0AE0254658923F3FA4B35AA4406AAB5EBD315F26B4E5E8C394373059C14549B5DF900
this comes from a username value of "darren". is there a way to get this out of the format it's currently in and back to the "darren" form so that I can use it as a search parameter on my database? thanks!
0
creeper808
2/24/2005 9:29:28 PM
Reply: