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);

posted on 2016-02-21 13:29  张大大123  阅读(168)  评论(0编辑  收藏  举报

导航