1. 访问登录页面: 获取cookie值
private bool GetIndex()
{
string url = “https://account.mail.ru/login”;
HttpClient client = new HttpClient();
HttprequestMessage request = new HttpRequestMessage(HttpMethod.Get, url);
request.Headers.Add(“accept”, “text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3”);
request.Headers.Add(“accept-encoding”, “gzip, deflate, br”);
request.Headers.Add(“accept-language”, “zh-CN,zh;q=0.9”);
request.Headers.Add(“user-agent”, UserAgent);
HttpResponseMessage response = client.SendAsync(request).Result;
if (!response.IsSuccessStatusCode)
{
Msg = “网络错误”;
return false;
}
List<string> setCookie = response.Headers.GetValues(“set-cookie”).ToList();
cookies = ToolData.getCookies(setCookie);
actToken = ToolD
本答案来自网络博客园,作者如下图