3

I have a project with a login page and a navigator page containing iframe in it. All the other pages in the project are loading inside iframe. I am setting one session value to store userid from login page. After logging in, when I click on some pages which is loading inside iframe and then click on an asp button which is outside of iframe (in navigator page) my session value is getting null.

When I searched in internet, I found that adding Privacy Preferences Project(P3P) header could solve the issue.So I added it in login page, navigator page and in pages which loads inside of iframe like the following:

private void Page_PreInit(object sender, System.EventArgs e){
HttpContext.Current.Response.AddHeader ("p3p","CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");
}

But still the same problem only with internet explorer 11.

Why does this happen? Please share your valuable suggestions to fix it.

1 Answers1

4

The problem lies with a W3C standard called Platform for Privacy Preferences or P3P for short. You can read all about the boring stuff via the link or else just install the P3P Compact Policy header below. This will allow Internet Explorer to accept your third-party cookie. You will need to send the header on every page that sets a cookie.

you need to add this Header in global.asax file beacause you need to add this header in all file ..

some days ago I have same problem when page called from i frame and I not getting session value when page is called in I-frame but I have this issue in all IE explorer ..

Here is my solution in

Global.asax file

    protected void Application_BeginRequest(object sender, EventArgs e)
   {
       HttpContext.Current.Response.AddHeader("p3p", "CP=\"CAO PSA OUR\"");
   }

and its works for me ..

P3P issue

IE had a new feature that would reject sessions in certain circumstances unless a specific header was sent clarifying the intentions of the web appliction. This seemed probable so I gave it a try.

if u add this on header

'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"'

It didn’t work so it was something else.

Anant Dabhi
  • 10,864
  • 3
  • 31
  • 49