cookie不是用window.open发送的 [英] cookie not sent with window.open

查看:80
本文介绍了cookie不是用window.open发送的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从Excel电子表格链接到网站。我链接到的页面是

getCookie.asp,它设置一个cookie,然后返回一些html打开一个

的新窗口,到同一个站点但是一个不同的页面(相同)文件夹)。


未收到cookie。有人能解释一下原因吗?


我通过添加一个值为

no-cache的缓存控制头来解决这个问题。这解决了这个问题。不幸的是,这导致了Internet Explorer的另一个问题,没有人可以搞清楚(基本上用

友好的错误消息开启IE显示错误页面无缘无故 - 我

向mpiasp.general发布了一条冗长的消息但是没有人有一个

线索。


我试过了每个缓存破坏标题的每个组合我都能想到

但没有其他人修复了关于没有收到cookie的问题。


所以基本上我是''在一个捕获22。如果我把缓存破坏者放入用户

将从IE获得一个令人讨厌的错误消息,除非他们有友好错误

消息关闭。如果我遗漏了cache-buster代码,那么会话cookie

就不会被返回,这意味着用户无法访问我的网站。帮助!


示例asp'如下。要重新创建问题,只需在excel中创建一个超链接

到getCookie.asp然后打开它(每次尝试之后你需要关闭Excel下的
)。顺便说一句,如果你直接在IE中键入URL

,一切正常......问题是从Excel打开时。


提前谢谢


Paul


---- getCookie.asp ------

<%

''缓存代码使下一页工作

''Response.CacheControl =" no-cache"

''将cookie发送回客户端

Response.Cookies(" PaulSessionID")=" PaulsCookie"

%>

< HTML>

< HEAD>

< SCRIPT>

window.open(''useCookie.asp'',''newWin'',''resizable,sc rollbars ,菜单栏,工具栏'')

;

< / SCRIPT>

< / HEAD>

< BODY>& nbsp;< / BODY>

< / HTML>

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

----- useCookie.asp ------

<%Response.CacheControl =" no-cache" ;%>

由t设置的cookie他的上一页是:

"<%= Request.Cookies(" PaulSessionID")%>"

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

I link to a web site from an Excel spreadsheet. The page i link to is
getCookie.asp which sets a cookie then returns back some html which opens a
new window, to the same site but a different page (same folder).

The cookie is not received. Can someone explain why?

I worked around this by adding a cache-control header with a value of
no-cache. This fixes the problem. Unfortunately that causes another
problem with Internet Explorer that no-one can figure out (basically with
friendly error messages turned on IE shows an error page for no reason - i
posted a lengthy message about this to m.p.i.asp.general but no-one has a
clue).

I have tried every combination of every cache busting header i can think of
but no other one fixes this problem about the cookie not being received.

So basically i''m in a catch-22. If i put the cache-buster in then users
will get a nasty error message from IE unless they have ''friendly'' error
messages off. If i leave out cache-buster code then the session cookie
doesn''t get returned which means the users cant access my site. Help!

Example asp''s are below. To recreate the problem simply create a hyperlink
to getCookie.asp in excel then open it (after each attempt you need to shut
down Excel). By the way everything works fine if you type the URL into IE
directly... the problem is when opening from Excel.

Thanks in advance

Paul

----getCookie.asp------
<%
''cache code which makes next page work
''Response.CacheControl = "no-cache"
''send cookie back to client
Response.Cookies("PaulSessionID") = "PaulsCookie"
%>
<HTML>
<HEAD>
<SCRIPT>
window.open(''useCookie.asp'',''newWin'',''resizable,sc rollbars,menubar,toolbar'')
;
</SCRIPT>
</HEAD>
<BODY>&nbsp;</BODY>
</HTML>
------------------------
-----useCookie.asp------
<%Response.CacheControl = "no-cache"%>
The cookie set by the previous page is:
"<%=Request.Cookies("PaulSessionID")%>"
---------------------------

推荐答案



首先,我很奇怪,任何类型的缓存标题都会与没有被收到的cookie有关。

这两个完全不相关的AFAIK。


无论如何,我正在努力把握你在这里所做的事情,所以如果我得到这个

对,这就是这样:

- 用户打开excel表,其中包含一个超链接getCookie.asp

- 用户点击此超链接,打开一个新的Internet Explorer

窗口,加载getCookie.asp

- getCookie.asp设置一个cookie,然后返回一些HTML& JavaScript打开一个

新窗口调用useCookie.asp

- useCookie.asp检索由getCookie.asp设置的cookie,并使用它

(呃!)


我能想到的第一件事是,第二个浏览器窗口是运行新浏览器会话的
,这使得它无法实现窗口到

检索第一个窗口设置的基于会话的cookie,

我不确定是不是这样,因为我不确定是否使用window.open()可以

导致创建一个新的浏览器会话,我确实知道这可以是

如果你右边打开一个新窗口 - 点击,然后在

新窗口中打开页面


IE已经/有一些设置,其中每个新IE窗口单独运行

申请,这也导致会话cookie迷路 (他们真的没有
,因为这是一个新的会议。)


我在IE 5中遇到的一个有趣的会话错误就是当你启动IE并且你的

主页不是一个网站(file://协议而不是http),当你打开一个新窗口时,你的会话也会导致你的会话丢失window.open()。


这可能有帮助吗?


" Paul" <再*************************** @ hotmail.com>在消息中写道

news:c3 ************* @ ID-141222.news.uni-berlin.de ...

First, I find it very odd that any kind of caching header would have
anything to do with cookies not being recieved.
The two are completely unrelated AFAIK.

Anyway, I''m trying to grasp what you are doing here, so if I''m getting this
right this is what happens:
- a user has an excel sheet open with a hyperlink in it to getCookie.asp
- the user clicks this hyperlink, which opens a new Internet Explorer
window, loading getCookie.asp
- getCookie.asp sets a cookie, then returns some HTML & JavaScript to open a
new window calling useCookie.asp
- useCookie.asp retrieves the cookie set by getCookie.asp, and uses it
(duh!)

the first thing that I can think of is that that second browser window is
running a new browser session, making it impossible for that window to
retrieve that session-based cookie set by the first window,
I''m not sure that is the case, cause I''m not sure if using window.open() can
cause a new browser session to be created, by I do know for sure this can be
the case if you open a new window by right-clicking, and opening a page in a
new window

IE has/had some setting where each new IE window runs as a seperate
application, which also caused session cookies to "get lost" (they don''t
really, cause it''s a new session).

A funny session bug I ran into in IE 5 is when you start IE and your
homepage is not a website (file:// protocol instead of http), also causes
your session to get lost when a new window is openened using window.open().

maybe this helps?

"Paul" <re***************************@hotmail.com> wrote in message
news:c3*************@ID-141222.news.uni-berlin.de...
我从Excel电子表格链接到一个网站。我链接到的页面是
getCookie.asp,它设置一个cookie,然后返回一些html打开
a新窗口,到同一个站点,但不同的页面(相同的文件夹)。

未收到cookie。有人能解释一下原因吗?

我通过添加一个值为
no-cache的缓存控制头来解决这个问题。这解决了这个问题。不幸的是,这导致Internet Explorer的另一个问题,没有人可以搞清楚(基本上打开IE浏览器友好的错误消息显示错误页面无缘无故 - 我发布了一条冗长的消息这对于mpiasp.general但没有人有一个
线索。

我已经尝试了每个缓存清除头的每个组合我可以认为
但没有其他修复关于没有收到饼干的这个问题。

所以基本上我在捕获22。如果我把缓存破坏者放入用户
将从IE获得一个讨厌的错误消息,除非他们有友好的错误消息关闭。如果我遗漏了cache-buster代码,那么会话cookie
不会被返回,这意味着用户无法访问我的网站。帮助!

示例asp'如下。要重新创建问题,只需在excel中创建
超链接到getCookie.asp然后打开它(在每次尝试之后你需要
关闭Excel)。顺便说一下,如果你直接在IE中输入网址,一切正常......问题是从Excel打开时。

提前致谢

Paul

---- getCookie.asp ------
<%
''缓存代码使下一页工作
''Response.CacheControl = no-cache
''将cookie发送回客户
Response.Cookies(" PaulSessionID")=" PaulsCookie"
%>
< HTML>
< HEAD>
< SCRIPT>

window.open(''useCookie.asp'',''newWin'',''resizable,sc rollbars,menubar ,工具栏'');
< / SCRIPT>
< / HEAD>
< BODY>& nbsp;< / BODY>
< / HTML>
------------------------

----- useCookie.asp ------
<%Response.CacheControl =" no-cache"%>
上一页设置的Cookie是:
"<%= Request.Cookies(" PaulSessionID" ;)%>"
-------------- -------------
I link to a web site from an Excel spreadsheet. The page i link to is
getCookie.asp which sets a cookie then returns back some html which opens a new window, to the same site but a different page (same folder).

The cookie is not received. Can someone explain why?

I worked around this by adding a cache-control header with a value of
no-cache. This fixes the problem. Unfortunately that causes another
problem with Internet Explorer that no-one can figure out (basically with
friendly error messages turned on IE shows an error page for no reason - i
posted a lengthy message about this to m.p.i.asp.general but no-one has a
clue).

I have tried every combination of every cache busting header i can think of but no other one fixes this problem about the cookie not being received.

So basically i''m in a catch-22. If i put the cache-buster in then users
will get a nasty error message from IE unless they have ''friendly'' error
messages off. If i leave out cache-buster code then the session cookie
doesn''t get returned which means the users cant access my site. Help!

Example asp''s are below. To recreate the problem simply create a hyperlink to getCookie.asp in excel then open it (after each attempt you need to shut down Excel). By the way everything works fine if you type the URL into IE
directly... the problem is when opening from Excel.

Thanks in advance

Paul

----getCookie.asp------
<%
''cache code which makes next page work
''Response.CacheControl = "no-cache"
''send cookie back to client
Response.Cookies("PaulSessionID") = "PaulsCookie"
%>
<HTML>
<HEAD>
<SCRIPT>
window.open(''useCookie.asp'',''newWin'',''resizable,sc rollbars,menubar,toolbar'') ;
</SCRIPT>
</HEAD>
<BODY>&nbsp;</BODY>
</HTML>
------------------------
-----useCookie.asp------
<%Response.CacheControl = "no-cache"%>
The cookie set by the previous page is:
"<%=Request.Cookies("PaulSessionID")%>"
---------------------------



J. Baute于2004年8月18日在microsoft.public.inetserver.asp.general写道:
J. Baute wrote on 18 mrt 2004 in microsoft.public.inetserver.asp.general:
我能想到的第一件事就是第二个浏览器窗口正在运行一个新的浏览器会话,使该窗口无法检索第一个窗口设置的基于会话的cookie,
the first thing that I can think of is that that second browser window is
running a new browser session, making it impossible for that window to
retrieve that session-based cookie set by the first window,




布丁的测试应该是[暂时]给cookie过期

日期,所以cookie是独立于会话的,只要

两个文件在同一个域中。

甚至更好:


一次测试2个cookie,

在2020年只给出一个到期日,

和会话变量。


如果会话cookie [没有到期日期的那个]和会话

变量返回空,你知道吗问题是。

-

Evertjan。

荷兰。

(请更改x''我的点数emailaddress)



The test of the pudding should be the [temporarily] giving a expiration
date to the cookie, so the cookie is session independent, as long as the
two files are in the same domain.

Even better:

test with 2 cookies at once,
giving only one an expiration date in 2020,
and also with a session variable.

If the session cookie [the one without expiration date] and the session
variable return empty, you know what the problem is.
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


J. Baute写道:
J. Baute wrote:
首先,我发现很奇怪任何类型的缓存标题都会与没有被收到的cookie有关。
两者是完全不相关的AFAIK。


我知道......告诉我这件事!!!

无论如何,我正在努力把握你在这里所做的事,所以如果我这是正确的,这就是发生的事情:
- 用户打开了一张带有超链接的Excel工作表
getCookie.asp
- 用户点击这个超链接,打开一个新的Internet Explorer
窗口,加载getCookie.asp
- getCookie.asp设置一个cookie,然后返回一些HTML& JavaScript打开一个新窗口调用useCookie.asp
- useCookie.asp检索由getCookie.asp设置的cookie,并使用
它(呃!)


正确,这正是我想要做的。

我能想到的第一件事就是第二个浏览器窗口正在运行一个新的浏览器会话,使得该窗口无法检索第一个窗口设置的基于会话的cookie,我不确定是不是这样,因为我不确定是否使用
IE已经/有一些设置,其中每个新的IE窗口作为单独的应用程序运行,这也导致会话cookie迷路 (他们不是真的,因为这是一个新的会议)。


现在回过头来我已经研究了IE(和不同版本的

)如何在它们自身的实例之间共享内存。 br />
这是一个非常好的假设......不幸的是我刚检查过它

并且它不是原因。
我在IE 5中遇到的一个有趣的会话错误是当你启动IE并且你的
主页不是一个网站(file:// protocol而不是http)时,也会导致你的会话丢失使用
window.open()打开一个新窗口。

这可能有帮助吗?


Nope ...尝试了主页的所有组合,它仍然是相同的。


你有没有(有人?!?)没有管理重现这个问题?我已经在

至少计算机上试过了,有些是在办公室里面的一些,无论是w2k还是NT4。

问题始终存在。


我开始认为它是与

window.open相关的安全更新的症状。但它不可能......因为如果它是那么饼干将会发送,不会*被发送,是吗!

" Paul" <再*************************** @ hotmail.com>在消息中写道
新闻:c3 ************* @ ID-141222.news.uni-berlin.de ...
First, I find it very odd that any kind of caching header would have
anything to do with cookies not being recieved.
The two are completely unrelated AFAIK.
I know... tell me about it!!!
Anyway, I''m trying to grasp what you are doing here, so if I''m
getting this right this is what happens:
- a user has an excel sheet open with a hyperlink in it to
getCookie.asp
- the user clicks this hyperlink, which opens a new Internet Explorer
window, loading getCookie.asp
- getCookie.asp sets a cookie, then returns some HTML & JavaScript to
open a new window calling useCookie.asp
- useCookie.asp retrieves the cookie set by getCookie.asp, and uses
it (duh!)
Correct, this is exactly what i''m trying to do.
the first thing that I can think of is that that second browser
window is running a new browser session, making it impossible for
that window to retrieve that session-based cookie set by the first
window, I''m not sure that is the case, cause I''m not sure if using
window.open() can cause a new browser session to be created, by I do
know for sure this can be the case if you open a new window by
right-clicking, and opening a page in a new window
IE has/had some setting where each new IE window runs as a seperate
application, which also caused session cookies to "get lost" (they
don''t really, cause it''s a new session).
Yes going back a bit now i''ve looked into how IE (and different versions of
it) shares its memory between instances of itself.
That''s a really good hypothesis... unfortunately i''ve just checked it out
and it isn''t the cause.
A funny session bug I ran into in IE 5 is when you start IE and your
homepage is not a website (file:// protocol instead of http), also
causes your session to get lost when a new window is openened using
window.open().

maybe this helps?
Nope... tried all combinations of home page and its still the same.

Have you (anyone?!?) not managed to reproduce this issue? I''ve tried it on
at least computers, some inside the office some outside, either w2k or NT4.
The issue is always there.

I''m starting to think its a symptom of a security update related to
window.open. But it can''t be... because if it was then the cookie would
*never* be sent, would it!
"Paul" <re***************************@hotmail.com> wrote in message
news:c3*************@ID-141222.news.uni-berlin.de...
我链接到来自Excel电子表格的网站。我链接到
的页面是getCookie.asp,它设置一个cookie,然后返回一些html
,它打开一个新窗口,到同一个站点,但是一个不同的页面
(相同的文件夹)。

没有收到cookie。有人能解释一下原因吗?

我通过添加一个值为
no-cache的缓存控制头来解决这个问题。这解决了这个问题。不幸的是,这导致Internet Explorer的另一个问题,没有人可以搞清楚(基本上
启用友好的错误消息IE显示错误页面没有
原因 - 我发布了一个冗长的消息这对于mpiasp.general
但是没有人有线索。

我已经尝试了每个缓存破坏头的每个组合我可以想到但没有其他人修复这个问题关于饼干没有被收到。

所以基本上我在捕捉22。如果我把缓存破坏者放入其中
用户将从IE获得一个讨厌的错误消息,除非他们有'友好''错误消息关闭。如果我遗漏缓存破坏程序代码
那么会话cookie不会被返回,这意味着用户无法访问我的网站。帮助!

示例asp'如下。要重新创建问题,只需在excel中创建一个指向getCookie.asp的超链接,然后打开它(每次尝试后都需要关闭Excel)。顺便说一下,如果你直接在IE中输入网址,一切正常......问题是从Excel打开


提前致谢

保罗

---- getCookie.asp ------
<%
''缓存代码,使下一页工作
'' Response.CacheControl =" no-cache"
''将cookie发回给客户
Response.Cookies(" PaulSessionID")=" PaulsCookie"
%>
< HTML>
< HEAD>
< SCRIPT>
I link to a web site from an Excel spreadsheet. The page i link to
is getCookie.asp which sets a cookie then returns back some html
which opens a new window, to the same site but a different page
(same folder).

The cookie is not received. Can someone explain why?

I worked around this by adding a cache-control header with a value of
no-cache. This fixes the problem. Unfortunately that causes another
problem with Internet Explorer that no-one can figure out (basically
with friendly error messages turned on IE shows an error page for no
reason - i posted a lengthy message about this to m.p.i.asp.general
but no-one has a clue).

I have tried every combination of every cache busting header i can
think of but no other one fixes this problem about the cookie not
being received.

So basically i''m in a catch-22. If i put the cache-buster in then
users will get a nasty error message from IE unless they have
''friendly'' error messages off. If i leave out cache-buster code
then the session cookie doesn''t get returned which means the users
cant access my site. Help!

Example asp''s are below. To recreate the problem simply create a
hyperlink to getCookie.asp in excel then open it (after each attempt
you need to shut down Excel). By the way everything works fine if
you type the URL into IE directly... the problem is when opening
from Excel.

Thanks in advance

Paul

----getCookie.asp------
<%
''cache code which makes next page work
''Response.CacheControl = "no-cache"
''send cookie back to client
Response.Cookies("PaulSessionID") = "PaulsCookie"
%>
<HTML>
<HEAD>
<SCRIPT>



window.open(''useCookie.asp'','' newWin'',''resizable,sc rollbars,menubar,toolbar'')


window.open(''useCookie.asp'',''newWin'',''resizable,sc rollbars,menubar,toolbar'')

;
< / SCRIPT>
< / HEAD>
< BODY>& nbsp;< / BODY>
< / HTML>
------------------ ------

----- useCookie.asp ------
上一页设置的cookie是:
"% = Request.Cookies时(QUOT; PaulSessionID&现状t;)%>"
---------------------------
;
</SCRIPT>
</HEAD>
<BODY>&nbsp;</BODY>
</HTML>
------------------------
-----useCookie.asp------
The cookie set by the previous page is:
"<%=Request.Cookies("PaulSessionID")%>"
---------------------------





这篇关于cookie不是用window.open发送的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆