我可以向XMLHttpRequest添加P3P响应头吗?

我在我的代码中使用了AjaxFileUpload插件,但是ie8和ie10没有将POST上的请求头中的Cookie发送到AjaxFileUploadHandler.axd。 我看到ie8底部的“eye”图标,看到AjaxFileUploadHandler.axd是“blobked”,所以这不是故意发送cookie。 我在我自己的web.config中有以下标记,但问题是AjaxFileUpload的脚本是从dll中提取的,所以即使使用这个AjaxFileUploadHandler仍然“被阻止”。 我将源代码下载到AjaxControlToolkit,它为项目创建了dll,现在我试图找到我可以添加P3P头的位置,以便即可。 我在工具包的代码中看到了XMLHttpRequest(),有没有办法将这个P3P头添加到它来满足ie?

编辑:修复是注释掉iframe.security =“restricted”; 我更新了以下代码。

     

特别是这个问题与工具包使用的iframe有关。 有没有办法只将P3P添加到iFrame?

  this.createIFrame = function() { var name = this._iframeName, iframe = document.createElement("IFRAME"); iframe.width = "0"; iframe.height = "0"; iframe.style.display = "none"; iframe.src = "about:blank"; //iframe.src = "javascript:'window.onload=function(){document.write(\\'document.domain=\\\"" + document.domain + "\\\";\\');document.close();};'"; iframe.id = name; iframe.name = name; //iframe.security = "restricted"; document.body.appendChild(iframe); iframe.contentWindow.name = name; $addHandlers(iframe, { load: Function.createDelegate(this, this.onIFrameLoadedHandler) }); this._iframe = iframe; }; this.onIFrameLoadedHandler = function (e) { ///  /// Event handler to capture when iframe receive response from server. ///  ///  if (!control._currentFileId) return; try { var iframe = this._iframe, doc = null; // Only test the iframe data, exception should thrown if something went wrong. if (iframe.contentDocument) // Firefox, Opera doc = iframe.contentDocument; else if (iframe.contentWindow) // Internet Explorer doc = iframe.contentWindow.document; else if (iframe.document) // Others? doc = iframe.document; if (doc == null) throw "Document not initialized"; // finalizing and upload next file control.doneAndUploadNextFile(control.getCurrentFileItem()); } catch (e) { // Cancelation / aborting upload can causing 'Access is denied' or 'Permission denied' on IE 9 bellow, // let's consider this exception is not trully error exception from server. if (!control._canceled || !(e.message && (e.message.indexOf("Access is denied") > -1 || e.message.indexOf("Permission denied") > -1))) { this.raiseUploadError(e); throw e; } } }; 

解决这个问题的方法是删除一条小行:

 iframe.security = "restricted"; 

将该行保留在那里会使if处理iframe与用户的“Restricted”列表中的站点具有相同的安全级别。