1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Rep Power

    ASPSESSIONID cookie seems to kill JavaScript cookie

    In add_cookies.asp, I use JavaScript to write a cookie called ControlFlow. When I then look at JavaScript's document.cookie I see:

    TableEditor8=RememberMe=true&UserName=xxxxxx; ASPSESSIONIDGGQQQNEU=KOMNHPBBGLJIIJBLFGFOCAKP; ControlFlow=Forward

    My cookie is there, (at the end, after the ASP session ID).

    When I do

    Response.Redirect "see_cookies.asp"

    and then use JavaScript in see_cookies.asp to look at document.cookie again, I see:


    Having moved to a different ASP page, I appear to have lost the JS cookie that was written by the first page (after the ASP Session ID).

    If I turn the two pages into plain-old HTML/JavaScript pages and move "by hand" from add_cookies.html to see_cookies.html, my new cookie survives just fine. (In that scenario there is, of course, no ASP Session ID cookie present.)

    Two questions:

    1) Am I analyzing the situation correctly? Is the ASP Session ID cookie really causing the Javascript cookie to disappear?

    2) If so, what can I do to make my JS cookie survive the Redirect?



    P.S. I have to use JS cookies and ASP cookies together like this. The JS cookies get re-written when the visitor uses the Back button, and that's important -- their job is to detect the use of the Back button.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Rep Power
    I too have encountered a strange problem using ASP & Javascript cookie functions.

    I have page1 which generates an ASPSESSIONID fine.

    From page1, I open a new window page2 which writes a javascript cookie. Note: The ASPSESSIONID has not changed.

    From page2, I click a link and refresh/focus page1. Here is where the problem arises: The only cookie value is the ASPSESSIONID and the newly created javascript cookie is lost.

    The strange thing is, that when I repeat the exact same process, the javascript cookie is saved fine. This only occurs the very first time.

    Sorry I'm not much help cdarling, but hopefully this helps other help us.


IMN logo majestic logo threadwatch logo seochat tools logo