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

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

am 09.04.2008 18:36:03 von betty

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="" &
DisplayText & "
"

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.
--
Betty

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

am 10.04.2008 07:15:12 von stcheng

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:
msdnmg@microsoft.com.

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


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



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

>From: =?Utf-8?B?YzY3NjIyOA==?=
>Subject: pass cookie in two domains work in IE, but not working in firefox?
>Date: Wed, 9 Apr 2008 09:36:03 -0700

>
>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="" &
>DisplayText & "
"
>
>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.
>--
>Betty
>

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

am 10.04.2008 11:29:42 von exjxw.hannivoort

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?



>
> ** 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.



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

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

am 10.04.2008 18:41:03 von betty

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="" &
DisplayText & "
"

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.
--
Betty


"c676228" wrote:

> 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="" &
> DisplayText & "
"
>
> 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.
> --
> Betty

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

am 11.04.2008 03:59:34 von stcheng

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:
msdnmg@microsoft.com.

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

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

--------------------
>From: =?Utf-8?B?YzY3NjIyOA==?=
>References: <2B356725-8BC6-40D9-BC05-39F07E9225C4@microsoft.com>
>Subject: RE: pass cookie in two domains work in IE, but not working in
firefox?
>Date: Thu, 10 Apr 2008 09:41:03 -0700

>
>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="" &
>DisplayText & "
"
>
>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.
>--
>Betty
>
>
>"c676228" wrote:
>
>> 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="" &
>> DisplayText & "
"
>>
>> 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.
>> --
>> Betty
>