Results 1 to 4 of 4

Thread: Am i missing something here with cookies

  1. #1

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539

    Am i missing something here with cookies

    OK back in the normal asp days setting and reading a cookie was so dam simple

    response.cookies("blah") = blah &
    request.cookies("blah")

    ok now the .net way (*** is that all about)

    ok heres my real question

    i have a control which handles the left hand side of my website on here ive got a littie area which displays users shopping cart so therefore i store the users cart id in the cookie,

    when ever i load the index page is get this error

    VB Code:
    1. If Request.Cookies("CartCookie").Value >= 0 Then
    Object reference not set to an instance of an object.
    its because i havnt defined the NEW part of the cookie...
    So if i do instead


    VB Code:
    1. Dim cookie As HttpCookie = New HttpCookie("CartCookie")
    2. if cookie.value > 0 then

    It allows me to run the page without errors, however every time i add to the cart its panel in this control is never displayed....

    Now am i just being thick or what
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Perhaps the real question is whether that code is executing before the page has finished loading its controls and state.

    What event does that code run in your user control?

  3. #3

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539
    onLoad
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

  4. #4
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Normally I would say try the PreRender event, but that shouldn't make a difference for the Request object.

    You stated assigning a new instance worked, but weren't too clear about 'its panel' not displaying...?
    Last edited by nemaroller; May 20th, 2004 at 05:24 PM.

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