Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


javascript Cookie cannot be not read on second page

Posted on 2009-02-20
Medium Priority
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
  • 2
LVL 16

Expert Comment

ID: 23699126
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.

Expert Comment

ID: 23710571
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

ID: 23725993
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


Accepted Solution

nathans earned 1500 total points
ID: 23726220
Yes the server name and path can affect what page can read the cookie... as I can not read a cookie from Microsoft.com this would cause security issues.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

569 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