Using HttpWebRequest
, how can we determine if the requested URL is attempting to set a cookie?
Also, how can we determine if any child elements (for example Google Analytics/third party iFrames) are attempting to set cookies?
Using HttpWebRequest
, how can we determine if the requested URL is attempting to set a cookie?
Also, how can we determine if any child elements (for example Google Analytics/third party iFrames) are attempting to set cookies?
您可以通过查看恰当命名的Cookies
属性来获取响应设置的 cookie 。
您想读取 HTTP 标头以检查 Set-Cookie 标头。请参阅http://en.wikipedia.org/wiki/HTTP_cookie#Setting_a_cookie。
这不会拾取通过 JS 设置的任何 cookie 或在浏览器中执行的任何其他内容,但如果服务器正在设置 cookie,则应该拾取它。