SitePoint Sponsor

User Tag List

Results 1 to 22 of 22

Thread: ASP: weird cookies problem

  1. #1
    32,817 silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ASP: weird cookies problem

    I have a rather interesting situation...

    Okay, I made this whole system thing (nearly done) relying on cookies. I set the cookies on one page and retrieve them on another. It worked great... Now it doesn't.

    The information is retrieved from the form fine. The information goes through some normalization routines fine. The cookies are created fine. I test the output, it's all fine. As soon as it goes to the new page... It isn't fine anymore... There is no content in the cookies whatsoever...

    It's "naff" as the other developer here said...

    Recap: The cookies are in the oven cooking, they cook beautifully, but as soon as we take the tray out they disappear!!!

    Digital Hitman, netmobs
    Personal blog: Ensight
    Twitter: @jeremywright

  2. #2
    32,817 silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd post the code, but it's like 500 lines...

    So if someone wants it emailed to them, I can do that
    Digital Hitman, netmobs
    Personal blog: Ensight
    Twitter: @jeremywright

  3. #3
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Send it to me... dinner says I can find the problem pretty quick.

    Code:
    <cents id="2">If you wrote REAL KSP, like it is supposed
    to be written, you wouldn't have these problems all the
    time, now would you?</cents>
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  4. #4
    32,817 silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you taught me your ways oh wise one I'd learn
    Digital Hitman, netmobs
    Personal blog: Ensight
    Twitter: @jeremywright

  5. #5
    32,817 silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sent to @badsyntax.com

    If you don't get it, let me know and I'll resend from an independent provider.
    Digital Hitman, netmobs
    Personal blog: Ensight
    Twitter: @jeremywright

  6. #6
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So, did you want to expire the cookie BEFORE you made it?? (SKUNKY BEER!)
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  7. #7
    32,817 silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    response.cookies("user").expires=date + 90...

    That's what's written in my ASP book.

    The cookies stuff hasn't changed in days and it's all been working for the last 10 days I've been doing this...
    Digital Hitman, netmobs
    Personal blog: Ensight
    Twitter: @jeremywright

  8. #8
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Let me guess, Wrox?

    Also, you want the cookie to expire in 90 days, right?
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  9. #9
    32,817 silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But of course... The "in a nutshell" book didn't cover bloody cookies @ all.

    Anyways, the wrox book said Date + 90 and said it was 90 days

    I'm willing to learn though
    Digital Hitman, netmobs
    Personal blog: Ensight
    Twitter: @jeremywright

  10. #10
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    o o ( "DELETE * FROM EveryBookStore WHERE Publisher LIKE '%wrox%';" )


    You DO realize that you are setting TWO different cookies, and only completely doing ONE of those TWO ?

    YOu have a conf cookie and a user cookie. You dont really need both, but either way, make sure you set them corrently.
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  11. #11
    32,817 silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, the conf one is meant to expire with the user session.

    The user one is the one I want to keep around.

    I figured 2 different cookies was the best way to achieve that.
    Digital Hitman, netmobs
    Personal blog: Ensight
    Twitter: @jeremywright

  12. #12
    32,817 silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    btw, if Date + 90 is wrong... what's right?
    Digital Hitman, netmobs
    Personal blog: Ensight
    Twitter: @jeremywright

  13. #13
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It isn't /wrong/, I just don't expect people to store cookies for THREE months. Technically, you should't add to the output of Date or Time or Now, as it COULD add it different at sometimes. TimeSerial and DateSerial were made for that.

    Code:
    response.cookies("conf")("description")=conf("description")
    response.cookies("conf").Expires=TimeSerial( Hour(Now), Minute(Now) + 5, Second(Now) )
    response.cookies("user")("conf")=conf("code")
    response.cookies("user").Expires=DateSerial( Year(Now), Month(Now)+ 3, Day(Now) )
    Which cookie is giving you the trouble - The conf one?
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  14. #14
    32,817 silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, the reason for the 3 months is that's what I figure it'll be before we have the time to do a full user login system for the site.

    Anyways, I'll rewrite the code but the problem is with the user one:

    http://server2.tacf.org/conf

    Is where it is...

    I can't give you the db though since it's a SQL server one...
    Digital Hitman, netmobs
    Personal blog: Ensight
    Twitter: @jeremywright

  15. #15
    32,817 silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm figuring you were looking @ the top "page" which now reads:
    Code:
    if task="getconfinfo" then
    	set conf=con.execute("SELECT code,description FROM Conferences WHERE code='" & confcode & "' ORDER BY description ASC")
    	response.cookies("conf")("description")=conf("description")
    	response.cookies("conf").Expires=TimeSerial( Hour(Now), Minute(Now) + 5, Second(Now) )
    	response.cookies("user")("conf")=conf("code")
    	response.cookies("user").Expires=DateSerial( Year(Now), Month(Now)+ 3, Day(Now) )
    	conf.close
    	set conf=nothing
    	response.redirect "index.asp?task=personalinfo"
    Digital Hitman, netmobs
    Personal blog: Ensight
    Twitter: @jeremywright

  16. #16
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    LMAO, I can have the db dude... you sent me all the info I need to make a remote connection to SQL Server, provided your firewall isn't too heavy. But, I won't and you know it.


    Do one thing for me.
    1 - close all your browser windows
    2 - delete ALL your cookies
    3 - clear your inet cache


    Then, try the cookie deal as if you have never been to the site before... I am willing to bet you have client or server cache crapping on you. I just got your cookie code to work on one of my NT5 boxes, so I dont think that is wrong.
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  17. #17
    32,817 silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ach, you know that isn't going to happen. We're running ISA now anyways so it's pretty tight.

    :in yoda voice: I will do as you say.

    brb
    Digital Hitman, netmobs
    Personal blog: Ensight
    Twitter: @jeremywright

  18. #18
    32,817 silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    worked... I knew it was weird
    Digital Hitman, netmobs
    Personal blog: Ensight
    Twitter: @jeremywright

  19. #19
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you owe me dinner
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  20. #20
    32,817 silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I didn't actually take the bet.

    BUT, call Pizza Pizza, use the phone number 416 245 4452. There's a 20$ credit on the account.

    If they ask for a password, it's "Ellel".
    Digital Hitman, netmobs
    Personal blog: Ensight
    Twitter: @jeremywright

  21. #21
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ack, I don't eat pizza...
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  22. #22
    32,817 silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    damn... guess I'm coming up then *L*
    Digital Hitman, netmobs
    Personal blog: Ensight
    Twitter: @jeremywright

Bookmarks

Posting Permissions

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