pass cookie in two domains work in IE, but not working in firefox?

C

c676228

Hi All

I have the following code which we want the query string value to be passed
from domain A to domain B.
www.domain1.com/program1.asp?12345
then we later on if customer navigates from domain1 to domain2, it should
bececome like this:
www.domain2.com/whatever.asp?12345
Suddenly we found out it only works in IE 7.0 and not working in firefox.
the code is as follow:


Dim HttpStr, LiveFlag
LiveFlag=True
If LiveFlag Then
HttpStr="https://"
Else
HttpStr="http://"
End If


pcnumber = Request.ServerVariables("QUERY_STRING")
If NOT isNULL(pcnumber) and Len(pcnumber)>=5 and Len(pcnumber)<=7 Then
Response.Cookies("id") = pcnumber
Else
id = Request.Cookies("id")
If ((IsNull(Trim(id))) OR (Trim(Len(id)) = 0)) Then
Response.Cookies("id") ="56789"
Else
Response.Cookies("id")=id
End If
End If

Response.Cookies("id").Domain = ".domain1.com"
Response.Cookies("id").Expires = "December 31, 2020"
Response.cookies("id").path="/"

id = Request.Cookies("id")

I have a function which is used to write a link dynamically for domain2, so
the id could be attached to the link:
Function WriteLinkPgm(byVal Domain2, byVal Pgm, byVal DisplayText)


WriteLinkPgm="<A HREF=" & HttpStr & Domain2 & Pgm & "?" & id & ">" &
DisplayText & "</A>"

End Function

The id is attached in IE 7.0 and but firefox doesn't follow that.
it always has the format like this in firefox:
www.domain2.com/whatever.asp?56789

It seems that it never get 12345 query string

What's going on here? Can you guys shed light on me?

thank you so much.
 
S

Steven Cheng [MSFT]

Hi Betty,

From your description, you're using cookie to share querystring values
between multiple web site(different top level domain name), correct?

Based on my understanding, for cookie itself, it is not allowed to share
between different web applications with different domain name(top level
domain). So far only cookies in websites that has identical parent domain
can be shared directly with each other. And for different websites with
different domain name, the current approach for sharing cookie is also rely
on querystring, also you need to explicitly provide a "cookie provider
page" in the certain site that contains the cookie and let another web site
use Response.Redirect to visit that page and that page will append cookie
in the querystring and redirect back to the original url.

For example, SiteA need cookie on SiteB:

**SiteB need a cookie provideer page(suppose named cookieprovider.asp).
this page will get parameters from querystring to determine which cookie
value does the requester need and retrieve those values. Then it use
response.redirecct to redirct back to siteA(append cookie in querystring)

** SiteA send response.Redirect to SiteB's cookieprovider.asp page(with the
cookie names or the original url if necessary in querystring)

** SiteB's cookieprovider page get parameters from url querystring and read
the certain cookie values. Append it to url querystring and redirect back
to SiteA's page.

#Sharing Cookies Across Domains
http://www.15seconds.com/issue/971108.htm

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.


This posting is provided "AS IS" with no warranties, and confers no rights.
 
E

Evertjan.

Steven Cheng [MSFT] wrote on 10 apr 2008 in
microsoft.public.inetserver.asp.general:
Hi Betty,

From your description, you're using cookie to share querystring values
between multiple web site(different top level domain name), correct?

Based on my understanding, for cookie itself, it is not allowed to
share between different web applications with different domain
name(top level domain). So far only cookies in websites that has
identical parent domain can be shared directly with each other. And
for different websites with different domain name, the current
approach for sharing cookie is also rely on querystring, also you need
to explicitly provide a "cookie provider page" in the certain site
that contains the cookie and let another web site use
Response.Redirect to visit that page and that page will append cookie
in the querystring and redirect back to the original url.

For example, SiteA need cookie on SiteB:

**SiteB need a cookie provideer page(suppose named
cookieprovider.asp). this page will get parameters from querystring to
determine which cookie value does the requester need and retrieve
those values. Then it use response.redirecct to redirct back to
siteA(append cookie in querystring)

Why not use a [hidden] iframe in stead of a response.redirect?

<iframe
href='http://other.com/cprov.asp?c=<%=Request.Cookies("A")%>&cn=A'
 
C

c676228

Hi Steven,

I probably didn't make things clear.
The following function call is sitting on domain1 and write a dynamic link
on domain1 for linking to domain2 will use the following function call. I
didn't share the cookies directly.

Function WriteLinkPgm(byVal Domain2, byVal Pgm, byVal DisplayText)


WriteLinkPgm="<A HREF=" & HttpStr & Domain2 & Pgm & "?" & id & ">" &
DisplayText & "</A>"

End Function


But I fixed yesterday I just replaced "id" with a very strange name. It
works perfectly fine in both IE and firefox. But still not figured out why is
that.

I haven't get a chance to read your and evertjan's response yet. I will get
back to you as soon as I can. Too busy with some other stuff.
 
S

Steven Cheng [MSFT]

Thanks for your reply Betty,

No problem. If you need any further help, please feel free to post here.

Good luck!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top