Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

headers 中添加了 cookie 但是请求头中始终没有携带 #64

Closed
hanxiaomin opened this issue Jul 27, 2018 · 2 comments
Closed

Comments

@hanxiaomin
Copy link

var site = new Site
{
CycleRetryTimes = 1,
SleepTime = 200,
Headers = new Dictionary<string, string>()
{
{ "Accept","/" },
{ "Referer", "https://ad.tt.com/login/"},
{ "Cookie","tt_webid=6582711285758166536" },
{ "Connection","keep-alive" },
{ "Content-Type","application/x-www-form-urlencoded" },
{ "User-Agent","Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36"}
}
};

@xljiulang
Copy link

默认的,HttpClientHandler的UseCookies为True,Cookie由CookieContainer维护,所以写到请求头的Cookie会被忽略,应该写入关联的CookieContainer;

@hanxiaomin
Copy link
Author

非常抱歉,第一次用dotnetspider, 应该怎么去关联CookieContainer呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants