Results 1 to 4 of 4

Thread: Response.Cookies glitch

  1. #1
    Guest

    Question

    I have a script that writes cookies. I'm well aware of the no-output-before-writing-cookies rule. I write all cookies at the very top of my scripts before anything else happens. I added another line of code that wrote one more cookie and for some reason it won't write that last one! There are several lines of Response.Cookies("blah") = "blah" above it and they all write their cookies just fine. For some reason that last one just won't write! The last cookie content isn't anything special, just the text "YES". Any thoughts on why that last one doesn't write?

  2. #2
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Post your code so we can help you.


    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  3. #3
    Guest

    Smile Ok, here's the code...

    Originally posted by monte96
    Post your code so we can help you.



    <%
    Response.Cookies("A31DC").Expires = "12/31/1990"
    Response.Cookies("A31DC") = "YES"
    Response.Cookies("A31DC").Expires = DateAdd("m", 3, Date)
    %>
    <html>
    <body bgcolor=#400080 background="" text=Silver link=#9966FF vlink=#9966FF alink=#9966FF leftmargin=15 topmargin=5>
    <Font face=Verdana>
    Welcome to the AREA31 Discount Gaming Club!!!<BR>
    Your membership will expire <%= DateAdd("m", 3, Date) %>.
    </Font>
    </body>
    </html>

    This is the entire asp page. The response.cookies lines above are just like the lines in another script which writes the cookies just fine with one exception. The future expiration above is set with the dateadd function, in the other script the future expiration is text. i.e. "12/31/2020" for basically -no- expiration.

    The dateadd fuction returns what you'd expect, a numeric date string which is 3 months in the future. It should work. Is there a limit on the number of cookies you can write? The other script writes 9 cookies.

  4. #4
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Try doing a response.write of your dateadd result. I think that is where your problem lies. There is no limit on the number of cookies. I've written pages that use many more than 9. Microsoft's documentation use Now() instead of Date in the DateAdd function. Perhaps there is a reason. I'm not totally sure why they included both functions in the language since they seem to return the same thing.

    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

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