在主机文件中的条目为什么为每个请求创建新SessionIDs [英] Why do entries in the host file create new SessionIDs for each request

查看:139
本文介绍了在主机文件中的条目为什么为每个请求创建新SessionIDs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在更新我们的网站之一。这个版本将有根据请求的主机名独特的行为。为了测试这种行为,我通过添加指向回到我的电脑项修改了我的电脑主机文件。

I am working on an update to one of our sites. This version will have unique behaviors based on the host name in the request. In order to test this behavior, I modified my computers host file by adding entries that point back to my computer.

127.0.0.1       newhostname.sample.com
127.0.0.1       oldhostname.sample.com

一切似乎都做工精细,直到我开始用Session对象的工作。我发现,每个请求毕竟我的会话变量丢失。进一步调查显示,从服务器的每个响应包含一个新的SessionID。

Everything seemed to be working fine, until I started working with the Session object. I discovered that after each request all my session variables were lost. Further investigation revealed that each response from the server contained a new SessionID.

这是为什么?

我能硬code一些标志使用的'localhost'的请求没有任何问题,完成我的测试。

I was able to hard code some flags to complete my testing using 'localhost' for requests without any problems.

推荐答案

我无法解释它,但我身边有一个可以接受的工作,以我自己的问题。

I can't explain it, but I have an acceptable work around to my own problem.

而不是主机文件我用我的本地IP使用127.0.0.1。因此,要求在我的主机文件名本地处理和我保持相同的SessionID整个网站。

Rather than use 127.0.0.1 in the Host file I am using my local IP. So requests to the names in my host file are handled locally and I keep the same SessionID throughout the site.

如果任何人都可以解释我很乐意知道IIS(或asp.net)使用127.0.0.1的时候在做​​什么。

If anyone else can explain I'd be happy to know what IIS (or asp.net) is doing when using 127.0.0.1.

这篇关于在主机文件中的条目为什么为每个请求创建新SessionIDs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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