I set my webbrowser control's proxy using this function
private void SetProxy(string proxy)
{
INTERNET_PROXY_INFO IPI = new INTERNET_PROXY_INFO();
IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY;
IPI.lpszProxy = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(proxy);
IPI.lpszProxyBypass = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi("local");
IntPtr intptrStruct = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(Sys开发者_如何学JAVAtem.Runtime.InteropServices.Marshal.SizeOf(IPI));
System.Runtime.InteropServices.Marshal.StructureToPtr(IPI, intptrStruct, true);
InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, System.Runtime.InteropServices.Marshal.SizeOf(IPI));
}
But I am unable to disable/remove the proxy afterwards, only swap it for another proxy. How can I remove the proxy completely. Already tried by registry.
No plain links as answers.
Try setting
IPI.dwAccessType
to INTERNET_OPEN_TYPE_DIRECT
精彩评论