Office Web applications (Word, Excel, Powerpoint) add-ins dropping cookie in IE11 on Windows 7

203 Views Asked by At

I am posting this as a question and answer for anyone else that has this issue as it was an absolute PITA to debug.


We have a taskpane add-in for Word that has a login page using cookies to store the session state. This works completely fine in everything except Word Web in Internet Explorer 11 on Windows 7.

By using Fiddler we can see that our cookies were getting set and everything is fine, even the session cookie stays the same (this is another issue altogether), but for whatever reason the .AspNet.ApplicationCookie is never getting sent back with the request for the HTML page - but it is getting sent back for the request for the JavaScript. WTF.

1

There are 1 best solutions below

0
On

See the answer to this post: Cookie blocked/not saved in IFRAME in Internet Explorer


The issue has to do with the fact that in Word Web the taskpane is in an IFRAME. It has something to do with P3P policies - which as far as we can tell don't get used by anything else.

Anyway here are the important bits from that answer:

I've spend a large part of my day looking into this P3P thing and I feel the need to share what I've found out.

I've noticed that the P3P concept is very outdated and seems only to be really used/enforced by Internet Explorer (IE).

The simplest explanation is: IE wants you to define a P3P header if you are using cookies.

...and the solution...

In short - to keep IE happy - add the following line to your PHP code (Other languages should look similar)

header('P3P: CP="Potato"');

Problem solved, and IE is happy with this potato.

So basically you need to add this HTTP Header to all responses to get IE to play ball.

If you are using IIS to host your website, add this to the web.config:

<configuration>
  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="P3P" value="CP='Potato'" />
      </customHeaders>
    </httpProtocol>
  <system.webServer>
<configuration>