[thelist] Cookies between ASP and ASP.NET?

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Wed Nov 9 18:50:16 CST 2005

   Bear in mind that non-alphanumeric characters may be encoded when attempting this.  That is, if you set a cookie to "bob -- ëúÿ"" in Classic, you will notice that it has become "bob+%2D%2D+%EB%FA%FF" when you retrieve it via ASP.NET.

   I'm not sure of the convention (looks like hex-something), although the use of Server.UrlDecode() on the result yields "bob -- " which seems to indicate that most "normal" English characters will be decoded correctly, and anything in the two-byte range will be discarded.



 From: "Ken Schaefer"  Ken at adOpenStatic.com 

-----Original Message-----
From: thelist-bounces at lists.evolt.org

: Is it possible to set a cookie in ASP and retrieve it in ASP.NET?


: It ain't working. 

Then I think you may be doing something wrong.

: I found this on Microsoft (and many other similar 
: articles on other sites): 
: How to Share Session State Between Classic ASP and ASP.NET

Session State <> Cookies - I think this is where you are going wrong. 

Session state is maintained on the server (for ASP inside the hosting Windows
process, and for ASP.NET either inproc, in SQL Server or in ASP.NET Session
State Service). The ASP process (e.g. dllhost.exe) can't just natively reach
into a SQL Server database and transparently retrieve an ASP.NET session. The
only link between sessions and cookies is that the SessionID (something that
identifies the user's session) is passed in a cookie.

If you just want to pass a value, and it's not particularly sensitive, then
just write it to a cookie (Response.Cookies), and read it back again in your
other pages (Request.Cookies)


More information about the thelist mailing list