Setting Cookies Problem Going From A Frame And Back In IE
- From: Alex Davidson <new1_NOSPAM_@xxxxxxxxxxxxxx>
- Date: Thu, 31 Mar 2005 17:08:32 -0700
I have 2 'vanity' sites - the first which I wrote in ASP (let's call it Site ASP) and the second which I inherited and wrote in PHP (the host at the time didn't do ASP - let's call this one Site PHP)
Each of these two sites log in to my internally-hosted e-commerce site, from which a user can click a link to save their login details which goes out to the vanity site, sets a cookie and comes right back.
Site ASP has been working for years. Site PHP has been working for about a year with PHP but I just moved it to the same hosting company as Site ASP due to the constant outages Site PHP was experiencing and the good luck we've had with Site ASP's host. After I moved Site PHP I copied in the ASP code I use in Site ASP and have observed the following:
Running the following code from a regular (non-framed) ASP page works just fine:
WWW.ECOMMERCESITE.COM/LEFT.ASP
<form name="cookieadd" action="http://www.vanitysite.com/cookieadd.asp?C=VALUE method="Post">
<input type="hidden" name="UserID" value="<%response.Write varID%>" ID="UserID">
<input type="hidden" name="UserPW" value="<%Response.write session("UserPW")%>" ID="UserPW">
<input type="hidden" name="UserName" value="<%Response.write session("UserFirstName") & " " & session("UserLastName")%>" ID="UserName">
</form>
<a href="JavaScript: document.cookieadd.submit()" class="smallurl" size="1">Remember My Login</a>
WWW.VANITYSITE.COM/COOKIEADD.ASP
<%response.buffer=true%>
<%' To stop ASP caching
Response.Expires = -1
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
Response.Cookies ("SMI")("UserID") = request("UserID")
Response.Cookies ("SMI")("UserPW") = request("UserPW")
Response.Cookies ("SMI")("UserName") = request("UserName")
Response.Cookies ("SMI").expires = DateAdd("m",12,Now())
url="http://WWW.ECOMMERCESITE.COM/left.asp?Cookie=" & request("UserID")
Response.Write ("<script>"&vbcrlf)
Response.Write ("parent.contents.location.replace('" & url & "');" & vbcrlf)
Response.Write ("</script>")However, while running this same code in a page that is a frame will work in Opera 7.54u2, Netscape 7.2, Mozilla 1.7.6 and FireFox 1.0.2, it will not run in IE6 - IE comes right back to LEFT.ASP as if it's done its thing but no cookie is ever set.
I have tested this further by having a straight link to a URL on the vanity site that sets a cookie with hard-coded values and comes right back to the calling page. This produces the same results - fine if it's in a non-framed page, doesn't write the cookie if it's in a frame.
To add to the confusion, the code works flawlessly on the other site, hosted on the same host but presumably on another server and very likely on a different version of Apache with Sun's ASP extensions.
Does anyone have any suggestion as to how to what might be going on and more importantly, how to fix it?
Thanks, Alex .
- Next by Date: A good, FREE, editable grid ?
- Next by thread: A good, FREE, editable grid ?
- Index(es):
Relevant Pages
|