javascript Cookie cannot be not read on second page

Posted on 2009-02-20
Last Modified: 2013-12-24
i have created a coldfusion page mainpage.cfm
in that file i have added three frames each frame pointing to separate pages -
page1.cfm, page2.cfm and page3.cfm
i am setting a cookie in page2.cfm using javascript - document.cookies etc.
now page1.cfm opens a new page newpage.cfm in a new window...
This newpage.cfm cannot read my cokkies - that i created in page2.cfm

i read@ limitaition of 20 cookies per transaction, but i dont think this is the problem because
and i have set lot of cookies in that newpage.cfm and all those works!!!
please help
this stuff was workign fine on windows2003 server but after i moved it to windows 2000 server it all messed up!!!

Question by:at999
    LVL 16

    Expert Comment

    Show us the code in page2.cfm that sets the cookie, the code in newpage.cfm that reads the cookie, and maybe any other code that might be relevant.
    LVL 5

    Expert Comment

    I imagine this is the old issue where you set a cookie and until you get to the next page it can not be seen.  So if you can tell us what you are wanting to accomplish maybe there is another way around it.  I would suggest not using Frames.  You could use Ajax or depends on what you are trying to accomplish.

    Author Comment

    i found the fix but i am not 100% sure what fixed it... it may be any of these two

    1. in my page1.cfm which is opening  newpage.cfm, i had mentioned to open http://myserveractualname/mywebfolder/newpage.cfm
    and my actual website was http://myservereasyname/mywebfolder/ ....
    ie my the server was used with a different name ie some  easy name(myservereasyname) on the intranet...  
    i changed in my page1.cfm to open http://myservereasyname/mywebfolder/newpage.cfm

    maybe this would have solved---
    2. Also in my page2.cfm(where i am setting cookie to be read by newpage.cfm ) , in the script where i was setting the cookie  i had mentione to run on server side... ie <script runat server>

    thanks for the help

    LVL 5

    Accepted Solution

    Yes the server name and path can affect what page can read the cookie... as I can not read a cookie from this would cause security issues.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn how to count occurrences of each item in an array.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now