Friday, September 11, 2009

Privacy Preferences Project (P3P) header for setting session cookies when nested in an iframe

This can be setup in IIS as CP="CAO DSP IVAa IVDa OUR BUS UNI OTC". Alternatively, I've added the following code to the Page_Load method of the master page.

        string p3pHeader = "CP=\"CAO DSP IVAa IVDa OUR BUS UNI OTC\"";
        if (!string.IsNullOrEmpty(p3pHeader))
        {
            //P3P headers will typically be set in IIS. This is more useful when running locally from Visual Studio.
            HttpContext.Current.Response.AddHeader("p3p", p3pHeader);
        }