[thelist] Cookies between ASP and ASP.NET?

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Wed Nov 9 23:25:59 CST 2005


   Are cookies enabled in the browser?  Even if they're not, you'll still be able to set and retrieve on the same page load.  Try posting to another .asp file and retrieving the cookie in *that* page to be sure.

 From: "Casey" aspnet at thecrookstons.com

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

Okay, thanks Ken. At least I know I'm headed in the right direction.

In the ASP page, the cookie is set as follows:
response.cookies("access_level") = session("access_level")

Then just to be sure the cookies is being set, I called it again on the same 
page:
response.write("level=" & request.cookies("access_level"))

It returns the value as expected. In the ASP.NET file, this returns 
nothing:
response.write(Request.Cookies("access_level"))

And this returns an error:
response.write(Request.Cookies("access_level").value)

System.NullReferenceException: Object reference not set to an instance of 
an object.

Thus my confusion. I'll keep searching, and in the mean time if anyone else 
can point out my (silly?) error....

Casey



More information about the thelist mailing list