ASP classic在Firefox中读取.NET cookie,但不读取IE

时间:2021-05-02 01:41:10

Having an issue with ASP.NET, when trying to set a cookie on subdomain1.mydomain.com to be read by subdomain2.mydomain.com.

在尝试在subdomain1.mydomain.com上设置cookie以供subdomain2.mydomain.com读取时,遇到ASP.NET问题。

"subdomain1" is an ASP.NET application running on IIS 6. "subdomain2" is an ASP Classic application running on IIS6.

“subdomain1”是在IIS 6上运行的ASP.NET应用程序。“subdomain2”是在IIS6上运行的ASP Classic应用程序。

What I don't understand is that when I test my .NET page (below) in Firefox, it works. If I test it under IE8, no cookie seems to get stored/passed to subdomain2. I've tried many variations on the code below, to no avail (including adding an expiry date/time):

我不明白的是,当我在Firefox中测试我的.NET页面(下面)时,它可以工作。如果我在IE8下测试它,似乎没有cookie存储/传递给subdomain2。我在下面的代码中尝试了很多变化,但无济于事(包括添加到期日期/时间):

Dim k As Guid = Guid.NewGuid
Dim c As New HttpCookie("Interstitial")

With c
.Values("a") = 1
.Values("b") = 2
.Values("c") = 3
.Values("d") = 4
.Domain = ".mydomain.com"
End With

Response.AppendCookie(c) 'Have also used Response.Cookies.Add(c)

Dim url As String = String.Format("https://subdomain2.mydomain.com/?d={0}", k.ToString)

Response.Redirect(url)

Other information that may be relevant:

其他可能相关的信息:

  • The code above is executed in response to a postback (button click)
  • 上面的代码是为了响应回发(按钮点击)而执行的

  • Under IE8, the response.redirect() seems to cause the browser request to never finish
  • 在IE8下,response.redirect()似乎导致浏览器请求永远不会完成

Any tips/ideas would be greatly appreciated.

任何提示/想法将不胜感激。

Thanks

2 个解决方案

#1


Have you tried running the page through Fiddler? This is a brilliant tool as it shows all the HTTP activity for a request.

你试过通过Fiddler运行页面吗?这是一个出色的工具,因为它显示了请求的所有HTTP活动。

I've previously has problems where there are strange browser issues which end up being quite esoteric like network config. Fiddler is great at lifting the lid on such problems.

我之前遇到过一些奇怪的浏览器问题,这些问题最终会像网络配置一样深奥。提琴手很擅长解决这些问题。

#2


I believe this by design (a buggy design perhaps). WinINET deliberately chooses not to forward Cookies set in a redirect response in the subsequent request if the request is not in the same domain.

我相信这是设计(也许是一个有缺陷的设计)。如果请求不在同一域中,WinINET会故意选择不在后续请求中转发重定向响应中设置的Cookie。

Don't quote me but I believe this is a result of a security patch for a bug which found WinINET forwarding any cookie in Set-Cookie headers of a redirect response to the location of the redirect even if the destination was not in the same domain.

不引用我,但我相信这是一个错误的安全补丁的结果,该错误发现WinINET转发重定向响应的Set-Cookie标头中的任何cookie,即使目标不在同一个域中。

My suspicion is that the bug fix for this is more draconian than it needed to be.

我怀疑这个错误修复比它需要的更严厉。

#1


Have you tried running the page through Fiddler? This is a brilliant tool as it shows all the HTTP activity for a request.

你试过通过Fiddler运行页面吗?这是一个出色的工具,因为它显示了请求的所有HTTP活动。

I've previously has problems where there are strange browser issues which end up being quite esoteric like network config. Fiddler is great at lifting the lid on such problems.

我之前遇到过一些奇怪的浏览器问题,这些问题最终会像网络配置一样深奥。提琴手很擅长解决这些问题。

#2


I believe this by design (a buggy design perhaps). WinINET deliberately chooses not to forward Cookies set in a redirect response in the subsequent request if the request is not in the same domain.

我相信这是设计(也许是一个有缺陷的设计)。如果请求不在同一域中,WinINET会故意选择不在后续请求中转发重定向响应中设置的Cookie。

Don't quote me but I believe this is a result of a security patch for a bug which found WinINET forwarding any cookie in Set-Cookie headers of a redirect response to the location of the redirect even if the destination was not in the same domain.

不引用我,但我相信这是一个错误的安全补丁的结果,该错误发现WinINET转发重定向响应的Set-Cookie标头中的任何cookie,即使目标不在同一个域中。

My suspicion is that the bug fix for this is more draconian than it needed to be.

我怀疑这个错误修复比它需要的更严厉。