如何在 http 和 https 之间共享 asp.net 会话
我读到,在 https 连接下运行的页面无法与在常规 http 下运行的另一个页面(或相同的页面)共享 InProc 会话(基于 cookie)。 我的站点在 Server 2003、IIS 6 和 .Net 2.0 上运行。
经过一些实验后发现,通过 https 连接时在会话中存储数据的页面即使在纯 http 下运行,也可以随后访问数据。
那么,我是否有可能或者应该检查一下 SSL 配置中的缺陷?
I read that a page which runs under an https connection cannot share an InProc Session (based on cookies) with another page (or the same for that matter) running under regular http. My site is running on Server 2003, IIS 6 and .Net 2.0.
After some experiments it appears that a page which stores data in session while being connected through https CAN subsequently access the data even if running under plain http.
So, is it possible or should I go over and look for flaws in the SSL configuration?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
来自 MSDN:
因此,基本上,如果
Secure
属性设置为false
,则 cookie 可以通过 HTTP 和 HTTPS 传递。我通过将其添加到我的
Global.asax
文件中避免了这个问题:这意味着如果会话 cookie 是通过 HTTP 创建的,则只能通过 HTTPS 访问它。
From MSDN:
So basically, the cookie can be passed over both HTTP and HTTPS if the
Secure
property is set tofalse
.I have avoided this issue by adding this to my
Global.asax
file:This means that if the Session cookie is created over HTTP, it will only be accessible over HTTPS.
IIS 设置
在 IIS 属性窗口中,ASP 选项卡下 –> 会话属性,有一个“安全连接上的新 ID”设置,
我自己通过将其设置为 false 解决了这个间歇性问题。
IIS setting
In the IIS properties window, under the ASP tab –> Session Properties, there is a setting for “New ID on Secure Connections”
I fixed this intermittent issue for myself by setting this to false.
到目前为止,搜索问题并没有引起太多讨论,仍在寻找。
编辑:现在可以找到一些东西了。
是的,如果两组页面位于同一个应用程序/网站中,它似乎可以正常工作。
所以我会继续前进,感到放心。
Searching for the problem doesn't turn up much chatter about it so far, still looking.
Edit: okay finding some stuff now.
Right it seems that it will work fine if both sets of pages are in the same application/website.
So I'd go ahead and carry on, feeling reassured.
如果上述任何解决方案不起作用,请尝试此方法。 经过几天的研究,我已经解决了这个问题。
If any of the above solution does not work try this. I have cracked this out after doing research of a couple of days.