C# WebBrowser 不同进程独立cookie 默认同一个进程内多个WebBrowser共享cookie
找了好久才找到的代码段,现在给大家共享##
#region 一个进程一个COOKIE的关键代码
/* 一个进程中的webBrowser共享一个cookie,webBrowser.Navigate()之前调用方法SuppressWininetBehavior()即可*/
[DllImport(“wininet.dll”, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
public static extern bool InternetSetOption(int hInternet, int dwOption, IntPtr lpBuffer, int dwBufferLength);
private unsafe void SuppressWininetBehavior()
{
/* SOURCE: http://msdn.microsoft.com/en-us/library/windows/desktop/aa385328%28v=vs.85%29.aspx
* INTERNET_OPTION_SUPPRESS_BEHAVIOR (81):
* A general purpose option that is used to suppress behaviors on a process-wide basis.
* The lpBuffer parameter of the function must be a pointer to a DWORD containing the specific behavior to suppress.
* This