• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

About Cookies in ASP

Hello all experts,

I can only write my cookies, but cannot read its data. Does anyone know what's wrong in my code or I have to set some configuration at the server?

Here is my code:
[File SaveCookies.asp]
<%
  Response.Buffer = True
  Response.Cookies("Test").Expires = "June 20, 2000"
  Response.Cookies("Test").Secure = False
  Response.Cookies("Test")("Name") = "Peerapol"
%>


[File ReadCookies.asp]
<%
  Response.Buffer = True
  Name = Response.Cookies("Test")("Name")
  Response.Write(Name)
%>

When I run ReadCookies.asp, my browser will report error.
Error Type:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'Response.Cookies(...)'

Note: My server is Windows2000 Advanced Server, and uses IIS.

Thanks in advance,
Peerapol
0
Mr_Peerapol
Asked:
Mr_Peerapol
  • 2
  • 2
1 Solution
 
mberumenCommented:
MR. Peerapol

to read your cookies you need to use the request object

i.e.




                      [File ReadCookies.asp]
                      <%
                        Response.Buffer = True
                        Name =Request.Cookies("Test")("Name")
                        Response.Write(Name)
                      %>

regards
0
 
Mr_PeerapolAuthor Commented:
mberumen ,

Please post your comment as the answer, I will accept it.

Thanks,
Peerapol
0
 
mberumenCommented:
MR. Peerapol

if you look at your screen there will be a link on the right side of the comment that says "accept comment as an answer"

it is customary to post answers as comments.  if  that way more people can contribute to your solution.    

good luck

                      to read your cookies you need to use the request object

                      i.e.




                                            [File ReadCookies.asp]
                                            <%
                                              Response.Buffer = True
                                              Name =Request.Cookies("Test")("Name")
                                              Response.Write(Name)
                                            %>

                      regards
0
 
Mr_PeerapolAuthor Commented:
Thanks,
Peerapol
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now