ASP.NET_SessionId cookie not sent in request from IE browser for intranet site

微笑、不失礼 提交于 2020-01-16 19:46:29

问题


When accessing an ASP.NET MVC application hosted on intranet from IE, the ASP.NET_SessionId is not sent in the request. This occurs on specific test serves. On our development serves hosting the same application, i see that the ASP.NET_SessionId cookie is sent.

Below is the difference i see form the network trace. On the server that not working.

<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>

The on the server where the session key cookie is passed.

<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>

Why would the cookie information not sent on this server. I have verified the internet option privacy setting and they allow cookies, but what i understand is this affect mainly the internet sites.


回答1:


Here you go Arvind.

Please note, this is just based on an old bug I experienced and might not be relevant to this exact case

My theory was re: something I came across a while ago using MVC3 and IE10/11.

Something to do with .NET not recognising the IE browser signature.

Add an App_Browsers folder in the root of your site then drop in BrowserFile.browser containing:

<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>

...and everything works again. It was an IE specific issue.




回答2:


Finally the problem was because of having a underscore'' in the host name setup for the application. The IE, seems to have problem when the host name is set with '', the IE prevents sending session cookies.

Answer from here helped me identify the issue



来源:https://stackoverflow.com/questions/50407890/asp-net-sessionid-cookie-not-sent-in-request-from-ie-browser-for-intranet-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!