Wilkins
Wilkins

Reputation: 185

Read ASP.Net Cookie from Classic ASP

I'm having some trouble reading the ASP.NET cookie from a Classic ASP file. Here is the code i'm using:

First off, I have the ASP.NET site setup in IIS. I setup an Application in the ASP.NET site and directed it to another folder in inetpub. This Application is called '/classicasp' because its all classic asp inside that application.

In the .aspx file, it is executing this code:

Response.Cookies["testcookie"].Path = "/classicasp";
Response.Cookies["testcookie"].Value = "test";

In the .asp file, it is executing this code:

<%
  for each cookie in Request.Cookies
     Response.Write( cookie & "=" & Request.Cookies(cookie) & "Path:" &
      "<br>")
  next
%>

But the .asp page is empty, there are no results displayed on the page from this For Next statement.. Any help on why this is happening? I think i followed instructions and am doing this how its supposed to be, but i guess not..

Upvotes: 0

Views: 4440

Answers (2)

Valerio Gentile
Valerio Gentile

Reputation: 1100

I think this is what you are looking for: Updating ASP cookie from ASP.NET (vice versa)

Upvotes: 1

Yahia
Yahia

Reputation: 70369

try

dim x,y
for each x in Request.Cookies
  response.write("<p>")
  if Request.Cookies(x).HasKeys then
    for each y in Request.Cookies(x)
      response.write(x & ":" & y & "=" & Request.Cookies(x)(y))
      response.write("<br />")
    next
  else
    Response.Write(x & "=" & Request.Cookies(x) & "<br />")
  end if
  response.write "</p>"
next

Upvotes: 1

Related Questions