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 s开发者_JS百科etup 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..
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
I think this is what you are looking for: Updating ASP cookie from ASP.NET (vice versa)
精彩评论