【问题标题】:ASP.NET_SessionId cookie not sent in request from IE browser for intranet site未在来自 IE 浏览器的 Intranet 站点请求中发送 ASP.NET_SessionId cookie
【发布时间】:2018-05-18 09:17:54
【问题描述】:

当从 IE 访问托管在 Intranet 上的 ASP.NET MVC 应用程序时,ASP.NET_SessionId 不会在请求中发送。这发生在特定的测试服务上。在我们的开发服务托管相同的应用程序中,我看到发送了 ASP.NET_SessionId cookie。

以下是我从网络跟踪中看到的差异。 在不工作的服务器上。

<entry>
        <pageref>1</pageref>
        <startedDateTime>2018-05-17T12:01:50.566+00:00</startedDateTime>
        <time>188</time>
        <request>
            <method>GET</method>
            <url>http://Server1/Content/Graphics/Cancel16.png</url>
            <httpVersion>HTTP/1.1</httpVersion>
            <cookies/>
            <headers>

在传递会话密钥 cookie 的服务器上。

<entry>
        <pageref>0</pageref>
        <startedDateTime>2018-05-16T13:31:47.415+05:30</startedDateTime>
        <time>31</time>
        <request>
            <method>GET</method>
            <url>http://localhost/site/Content/Graphics/Cancel16.png</url>
            <httpVersion>HTTP/1.1</httpVersion>
            <cookies>
                <cookie>
                    <name>ASP.NET_SessionId</name>
                    <value>14zbzcehugb2dvsq0axwo5ud</value>
                </cookie>
            </cookies>
            <headers>

为什么cookie信息不会在此服务器上发送。我已经验证了互联网选项隐私设置并且它们允许使用 cookie,但我理解这主要影响互联网站点。

【问题讨论】:

  • 在 IE 中,您是否看到您的 URL 因添加了会话 ID 而被更改?另外 - 你使用的是什么版本的 MVC 和 IE?
  • @scgough Session Id 没有在 URL 中传递,我们使用的是 MVC 5.0 和 IE 11,.net 框架是 4.5.2
  • 好的 - 没问题。这不是我当时想的:)
  • @scgough 请让我知道您对具有会话 ID 的 URL 的想法,在我的情况下,该 URL 正在使用开发服务器上的会话 ID 进行更改。但是在有问题的服务器上它没有被改变
  • 你去 - 见下文

标签: asp.net-mvc session internet-explorer cookies


【解决方案1】:

给你阿文德。

请注意,这只是基于我遇到的一个旧错误,可能与这个确切案例无关

我的理论是:我不久前在使用 MVC3 和 IE10/11 时遇到的问题。

与 .NET 无法识别 IE 浏览器签名有关。

在您网站的根目录中添加一个App_Browsers 文件夹,然后放入包含以下内容的BrowserFile.browser

<browsers>
  <browser refID="Default">
    <capabilities>
      <!-- To avoid wrong detections of e.g. IE10 -->
      <capability name="cookies" value="true" />
      <capability name="ecmascriptversion" value="3.0" />
    </capabilities>
  </browser>
</browsers>

...一切都恢复正常了。这是一个特定于 IE 的问题。

【讨论】:

    【解决方案2】:

    最后问题是因为在应用程序的主机名设置中有一个下划线''。当主机名设置为''时,IE似乎有问题,IE阻止发送会话cookie。

    Answer from here helped me identify the issue

    【讨论】:

      猜你喜欢
      • 2018-05-19
      • 2020-04-03
      • 2011-01-05
      • 2022-01-21
      • 2014-01-11
      • 2019-08-19
      • 2013-10-18
      • 1970-01-01
      相关资源
      最近更新 更多