问题
I want to get ALL cookies from the site, but most of them are HttpOnly.
JS does not work:
var cookie = webControl.ExecuteJavascriptWithResult("document.cookie;");
How to get HttpOnly cookies?
回答1:
why you're trying to get Cookies back from Javascript? ... the best opinion to get all Headers (including Cookies) is to use Awesomium with a Proxy written also in C# ...
Wiki: ProxyConfig http://docs.awesomium.net/html/P_Awesomium_Core_WebPreferences_ProxyConfig.htm
Github C# Proxy: https://github.com/justcoding121/Titanium-Web-Proxy
Titanium has 2 useful Events:
proxyServer.BeforeRequest += OnRequest;
proxyServer.BeforeResponse += OnResponse;
a Simple implementation which gave you the SystemEventArgs is:
public async Task OnRequest(object sender, SessionEventArgs e)
public async Task OnResponse(object sender, SessionEventArgs e)
After implementation you have the possibilty to grap all Headers and delete or modifiy it :)
Hope it helps ...
来源:https://stackoverflow.com/questions/43287040/how-to-get-httponly-cookies-from-awesomium