C#删除WebBrowser控件的Session

因最近做一个成绩查询导出的程序,用到webbrowser控件,该查询的网站限制一个会话只能查询3次成绩,而我要查询4000多人的成绩。

using System.Runtime.InteropServices;

private const int INTERNET_OPTION_END_BROWSER_SESSION = 42;

[DllImport("wininet.dll", SetLastError = true)]private static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int lpdwBufferLength);

然后在需要清除session的地方使用

InternetSetOption(IntPtr.Zero, INTERNET_OPTION_END_BROWSER_SESSION, IntPtr.Zero, 0);

原文地址:https://www.cnblogs.com/aiwz/p/6153892.html