cookie problem with iframe and different domain

Reply

Join Date: May 2005
Posts: 1
Reputation: ortora is an unknown quantity at this point 
Solved Threads: 0
ortora ortora is offline Offline
Newbie Poster

cookie problem with iframe and different domain

 
0
  #1
May 3rd, 2005
Hello everyone, I have an ASP chat inside an IFRAME. The ASP file is hosted on a different domain than the main website.
When the user logs on by entering their name, the chat stores a cookie so the user can start posting messages. However since the cookie is stored using the main domain (not the iframe), the chat doesn't recognise it anymore and keeps asking to log on.

How can I get it to recognise the cookie, or to store it with the correct domain?

Your help is appreciated

Here is the coding used by the chat to recognise the cookie:

<%
'/// Get Nick Name
nick=request("nick")
xlaSBnick=request.cookies("xlaSBnick")"
if nick<>"" then
response.cookies("xlaSBnick")=nick
xlaSBnick=nick
end if
if xlaSBnick="" then
formproperties="action=bottomframe.asp onsubmit='return validatenick();'"
else
formproperties="action=receiveframe.asp target=xlaSBreceive onsubmit='return shout();'"
end if
%>
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1
Reputation: dmcg4rry is an unknown quantity at this point 
Solved Threads: 0
dmcg4rry dmcg4rry is offline Offline
Newbie Poster

Re: cookie problem with iframe and different domain

 
0
  #2
Sep 11th, 2007
Originally Posted by ortora View Post
Hello everyone, I have an ASP chat inside an IFRAME. The ASP file is hosted on a different domain than the main website.
When the user logs on by entering their name, the chat stores a cookie so the user can start posting messages. However since the cookie is stored using the main domain (not the iframe), the chat doesn't recognise it anymore and keeps asking to log on.

How can I get it to recognise the cookie, or to store it with the correct domain?

Your help is appreciated

Here is the coding used by the chat to recognise the cookie:
I'm having this same problem... I got around it temporarily by setting each user's browser to trust the domain. I hope there's a better solution though.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 12
Reputation: fxj10cn is an unknown quantity at this point 
Solved Threads: 1
fxj10cn fxj10cn is offline Offline
Newbie Poster

Re: cookie problem with iframe and different domain

 
0
  #3
Sep 14th, 2007
You can not using cookies. You should use javascript to send the information to the iframe
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 437
Reputation: Fungus1487 is on a distinguished road 
Solved Threads: 50
Fungus1487's Avatar
Fungus1487 Fungus1487 is offline Offline
Posting Pro in Training

Re: cookie problem with iframe and different domain

 
0
  #4
Sep 14th, 2007
you can set the domain on a cookie as follows

  1. Response.Cookies("CookieName").Domain = "www.mydomain.com"

and even a path of the cookie on that domain to make sure it can only be read by the path on that domain and not another

  1. Response.Cookies("CookieName").Path = "/maindir/subdir/path"
When Autumn Falls [ http://www.whenautumnfalls.co.uk ] &&
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 1
Reputation: ask2gaurav is an unknown quantity at this point 
Solved Threads: 0
ask2gaurav ask2gaurav is offline Offline
Newbie Poster

Re: cookie problem with iframe and different domain

 
0
  #5
Dec 23rd, 2008
Some browsers allow third party cookies and in some browsers, like Internet Explorer, it depends on the privacy settings of the browser. In IE6 (Internet Explorer 6) with the default privacy setting of ‘Medium’, third party cookies will be deleted.

As it turns out, there is a simple solution. If you supply a ‘compact privacy policy’ with your page, then IE will treat the cookies with respect and let them through.

ASP.Net code
 
  HttpContext.Current.Response.AddHeader("p3p", "CP=\""IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""")

PhP code
 
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');

For more information on this, please visit this url:
http://viralpatel.net/blogs/2008/12/...th-iframe.html
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC