0

This request is about Internet Explorer Version 11.778.18362.0

I have an ASP.NET Web Application that shows some text and images on a web page. Everything works fine, but when the page is loaded in IE11 and I click Print Preview, it calls the server again to reload some images which are not cached, in those calls it does not send the special cookie that goes by the name set up in <form> element under <authentication mode="forms"> in web.config

I have <httpCookies domain=".domain.com"> set up.

Here are the request headers when the page loads (non-print-preview) and everything works.

GET /Misc/ImageHandler.aspx?ID=qby7WpWRfig%3d&Type=Header&Thumbnail=1 HTTP/1.1
Accept: image/png, image/svg+xml, image/jxr, image/*;q=0.8, */*;q=0.5
Referer: http://path.to/something/Awesome.aspx?ID=6wK%2bnN2D1qY%3d&ms=1588006101660
Accept-Language: en-US
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
Accept-Encoding: gzip, deflate
Host: path.to
Connection: Keep-Alive
Pragma: no-cache
Cookie: ASP.NET_SessionId=bafvvytbxb1eevhbbn4uwahc; __AntiXsrfToken=4073624154744106997e1d0e2c00b074; __utmc=268869105; LoginServerName=MachineName : 4/27/2020 1:03:02 PM : 192.168.2.88; LoginSessionID=bafvvytbxb1eevhbbn4uwahc : 4/27/2020 : 192.168.2.88; FormsAuthCookieName=B4BA26AFEBCBB642B9404AA6EC427A289F8C2D4BC6AB25D66F41CFD824A319598398B612147A504FA3B0CB2095A4E5ED7CFA8E675EBE40459585F788340EE5977B2D4019BFC074776D28DECB14BEAD124B6B1585; __utmz=268869105.1588005744.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=268869105.758733509.1588005744.1588005744.1588005744.1; __utmb=268869105.2.10.1588005744; __utmt=1

Here are the request headers when the image is requested again

GET /Misc/ImageHandler.aspx?ID=qby7WpWRfig%3d&Type=Header&Thumbnail=1 HTTP/1.1
Accept: image/png, image/svg+xml, image/jxr, image/*;q=0.8, */*;q=0.5
Accept-Language: en-US
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
Accept-Encoding: gzip, deflate
Host: path.to
Connection: Keep-Alive
Cookie: __AntiXsrfToken=4073624154744106997e1d0e2c00b074; __utmc=268869105; LoginServerName=MachineName : 4/27/2020 1:03:02 PM : 192.168.2.88; LoginSessionID=bafvvytbxb1eevhbbn4uwahc : 4/27/2020 : 192.168.2.88; __utmz=268869105.1588005744.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=268869105.758733509.1588005744.1588005744.1588005744.1; __utmb=268869105.2.10.1588005744; __utmt=1

Notice the REFERRER and FormsAuthCookieName are missing in the subsequent request. Why is it doing this? What am I doing wrong?

I have tried so many different things I found online such as the changes in web.config in httpCookies element as well as <forms> element. Already have installed the patch on the server to update the browser profiles.

2 Answers 2

0
  1. Does your domain name contain special characters (like - or _) or non-alphanumerical characters? If yes then it can cause this issue.

  2. Another thing you can try is to add a tag ticketCompatibilityMode in the web.xml file.

Example:

ticketCompatibilityMode="Framework40"

Reference:

ASP.NET authentication cookie disappears, only in IE, only from specific locations

4
  • Know it does not. It only contains dots (.).
    – fahadash
    Commented Apr 28, 2020 at 16:29
  • Did you make a test with ticketCompatibilityMode? Does it make any difference? If you did not test it then can you please make a test to see whether it helps in this issue. Let us know about your testing results. Commented Apr 29, 2020 at 3:25
  • DId not work. <form loginUrl="~/Security/Login.aspx" name="MyCustomCertAuthCookieLongName" slidingExpiration="true" timeout="60" ticketCompatibilityMode="Framework40" />
    – fahadash
    Commented Apr 29, 2020 at 14:30
  • Try to add domain="domain.com" cookieless="UseCookies" in the above form tag to see whether it helps to solve the issue. Another thing you can do is to go to the View menu in the IE browser and select the 'web page privacy report' option. Check whether cookies are accepted for your site or not. Commented Apr 30, 2020 at 9:33
0

I had the same problem.

It no longer occurs when the cache is enabled, so I avoided it below.

Web.config

<location path="ImageHandler.aspx">
  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <remove name="Pragma" />
      </customHeaders>
     </httpProtocol>
  </system.webServer>
</location>
1
  • Good to know but we cannot enable cache.
    – fahadash
    Commented Jun 9, 2021 at 12:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.