1.引进
名称空间 using System.Runtime.InteropServices;
2.注册
[DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool InternetSetCookie(string lpszUrlName, string lbszCookieName, string lpszCookieData);
3.
#region 写入cookie
// set cookie
InternetSetCookie(url, "Token", "value=" + strToken +"; expires=Thu, 01-Jan-2020 00:00:01 GMT");
// navigate
webBrowser1.Navigate(url);
#endregion
注意      : InternetSetCookie (url地址,cookie名称,cookie内容及过期时间) 
expires过期时间格式应该为GMT

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-10
  • 2021-12-07
  • 2022-02-04
相关资源
相似解决方案