Reading the cookies in ASP.NET

  • Thread starter Thread starter Priya
  • Start date Start date
P

Priya

Guys,
I am having trouble in reading the cookies in ASP.NET which is written
through the classic ASP page. When I write the cookie in ASP.NET and
try to read the cookie in ASP.NET it works. But if I write through
classic ASP and try to read it in ASP.NET it is not working. Any
ideas.
Thanks in advance
Priya
 
I use something like this (in a WebRequest/WebResponse). Maybe it will be of
some help

dim i as int32
for i = 0 to mgWebResponse.cookies.count - 1
dim hc as httpcookie
hc = new httpcookie(mgWebResponse.cookies.item(i).name)
hc.value= mgWebResponse.cookies.item(i).value.tostring()
hc.expires = datetime.now.adddays(2)
hc.path = mgWebResponse.cookies.item(i).path
HttpContext.Current.Response.AppendCookie(hc)
next i
 
Priya Ramamoorthy said:
That worked thanks a lot !!
Priya
I will take my word back. I am unable to read the cookie written
through ASP from ASP.NET. I know I need to set the path of cookie
correctly.
When I set the path of my Cookie Response.Cookie("Test").Path = "/" in
ASP and try to read in ASP.NET it says nothing has been set. When I
tried to set the path to the other folder in ASP.NET for ex


Dim Cookie as HttpCookie = Request.Cookies("Test")
Cookie.Path = "/test"

I am getting a error "Object reference not set to an instance of an
object"

Help please
Thanks
Priya
 
Back
Top