943,715 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 30152
  • ASP RSS
May 3rd, 2005
0

cookie problem with iframe and different domain

Expand 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:

Quote ...
<%
'/// 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
%>
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ortora is offline Offline
1 posts
since May 2005
Sep 11th, 2007
0

Re: cookie problem with iframe and different domain

Click to Expand / Collapse  Quote originally posted by ortora ...
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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dmcg4rry is offline Offline
1 posts
since Sep 2007
Sep 14th, 2007
0

Re: cookie problem with iframe and different domain

You can not using cookies. You should use javascript to send the information to the iframe
Reputation Points: 10
Solved Threads: 1
Newbie Poster
fxj10cn is offline Offline
12 posts
since Sep 2007
Sep 14th, 2007
0

Re: cookie problem with iframe and different domain

you can set the domain on a cookie as follows

ASP Syntax (Toggle Plain Text)
  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

ASP Syntax (Toggle Plain Text)
  1. Response.Cookies("CookieName").Path = "/maindir/subdir/path"
Reputation Points: 66
Solved Threads: 56
Posting Pro in Training
Fungus1487 is offline Offline
459 posts
since Apr 2007
Dec 23rd, 2008
0

Re: cookie problem with iframe and different domain

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ask2gaurav is offline Offline
1 posts
since Dec 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: can caching improve speed
Next Thread in ASP Forum Timeline: validate anchor tag





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC