/// <summary> /// Invokes <c>InternetOpen</c>, handling error conditions. /// </summary> /// <param name="agent">The user agent or process using WinInet. This is sent as the HTTP user agent and WinInet logs.</param> /// <param name="accessType">The type of the proxy used, if any.</param> /// <param name="proxyName">The name of the proxy server if <paramref name="accessType"/> is <see cref="InternetOpenHandle.AccessType.Proxy"/>.</param> /// <param name="proxyBypass">The list of host names or IP addresses that are not routed through the proxy when <paramref name="accessType"/> is <see cref="InternetOpenHandle.AccessType.Proxy"/>. This list may contain wildcards or be equal to the string <c>"<local>"</c>, but should not be an empty string.</param> /// <param name="flags">The flags to use for this internet handle.</param> /// <returns>The opened internet handle.</returns> public static SafeInternetHandle InternetOpen(string agent, InternetOpenHandle.AccessType accessType, string proxyName, string proxyBypass, InternetOpenHandle.Flags flags) { SafeInternetHandle ret = DoInternetOpen(agent, accessType, proxyName, proxyBypass, flags); if (ret.IsInvalid) { throw GetLastInternetException(); } return(ret); }
private static extern SafeInternetHandle DoInternetOpen(string lpszAgent, InternetOpenHandle.AccessType dwAccessType, string lpszProxyName, string lpszProxyBypass, InternetOpenHandle.Flags dwFlags);