简体   繁体   中英

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

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM