Results 1 to 6 of 6

Thread: Need Help With Cookies

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Posts
    63

    Unhappy

    I am new to cookies... I have attempted to run this test script to see why my original cookies script won't work and I am recieving the following error message:

    ========================================================
    Microsoft VBScript runtime error '800a01b6'

    Object doesn't support this property or method

    /secure/manage/cookie/COOKIELIST.ASP, line 5
    ========================================================

    Here is my code for the error message listed above:
    ========================================================
    <%@ LANGUAGE=VBScript %>

    <%
    IF LEN(RESPONSE.COOKIES("TEST")) = 0 THEN
    RESPONSE.WRITE "YOU DO NOT ACCEPT COOKIES!"
    ELSE
    RESPONSE.WRITE "YOU ACCEPT COOKIES!"
    END IF
    %>

    <html>
    <head>
    <title>New Page 1</title>
    </head>
    <body background="/images/bground.gif" bgcolor="#ffffff" text="#000000" marginheight="0" topmargin="0">
    </body>
    </html>
    ========================================================






    And here is the code for the page that is supposed to create the cookie and redirect to this page listed above:

    ========================================================
    <%@ Language=VBScript %>

    <%

    RESPONSE.COOKIES("TEST") = "TESTING"

    RESPONSE.REDIRECT "COOKIELIST.ASP"

    %>

    <html>

    <head>
    <title>New Page 1</title>
    </head>

    <body background="/images/bground.gif" bgcolor="#ffffff" text="#000000" marginheight="0" topmargin="0">
    </body>

    </html>
    ========================================================

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    I think you're getting your requests and responses mixed up!

    http://www.irt.org is a useful site

    Code:
    <% 
    
    ' SET A TEXT STRING
    Response.Cookies("test") = "this value"
    
    IF len( Request.Cookies("test")) = 0 THEN 
    RESPONSE.WRITE( "YOU DO NOT ACCEPT COOKIES!")
    ELSE 
    RESPONSE.WRITE( "YOU ACCEPT COOKIES!")
    END IF 
    %> 
    
    <html> 
    <head> 
    <title>New Page 1</title> 
    </head> 
    <body background="/images/bground.gif" bgcolor="#ffffff" text="#000000" marginheight="0" topmargin="0"> 
    </body> 
    </html>
    Mark
    -------------------

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2000
    Posts
    63
    Cool... that works... so now i guess the problem is in my code... here is my original project that I was working with...

    I am getting NO error message... but on the same note... the text I am submitting on the first page is not being passed on via cookies to the second page...

    Kind Regards,
    Hakan

    CODE FROM THE MAIN PAGE:
    ============================================================
    <%@ Language=VBScript %>

    <% Option Explicit %>

    <%

    IF NOT ISEMPTY(Request.Form("Submit")) then

    Response.Cookies("HaKCOOKIE")("FirstName") = request.form("txtFNAME")
    Response.Cookies("HaKCOOKIE")("LastName") = request.form("txtLNAME")
    Response.Cookies("HaKCOOKIE").Expires = Date + 500
    response.redirect "cookielist.asp"

    END IF

    %>


    <html>

    <head>
    <title>New Page 1</title>
    </head>

    <body>

    <p><input type="text" name="txtFNAME" size="20"></p>
    <p><input type="text" name="txtLNAME" size="20"></p>
    <p>&nbsp;</p>

    <form method="POST">
    <p><input type="submit" value="Submit" name="Submit"></p>
    </form>

    </body>

    </html>



    CODE FROM THE RESULTS PAGE:
    ============================================================
    <%@ LANGUAGE=VBScript %>

    <%
    fname = REQUEST.COOKIES("HaKCOOKIE")("FirstName")
    lname = REQUEST.COOKIES("HaKCOOKIE")("LastName")
    %>
    <html>

    <head>
    <title>New Page 1</title>
    </head>

    <body>
    <%RESPONSE.WRITE FNAME%>
    <%RESPONSE.WRITE LNAME%>
    </body>

    </html>

  4. #4
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Your code has been shot to bits!

    <form method="POST"> needs to before the <p><input type="text" name="txtFNAME" size="20"></p>

    and there's no "action"
    Mark
    -------------------

  5. #5
    Addicted Member
    Join Date
    Feb 1999
    Location
    Belfast
    Posts
    254
    Hi,
    are the cookies actually created on your machine, i.e. can you open the file in your:

    /winnt/profile/your_name/cookies/cookie_name

    It dhould be there as a simple text file.


    Thanks

    Lenin

  6. #6

    Thread Starter
    Member
    Join Date
    Jan 2000
    Posts
    63

    Smile

    Thanks guys for all your help... as far as the code being shot to bits... I apologize... I guess we all have to learn somewhere...

    Thanks Again,
    Hakan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width