private static IWebProxy GetProxy() { if (webProxy == null) { // Uses HttpEnvironmentProxy class to mimic .NET Core behavior HttpEnvironmentProxy.TryCreate(out webProxy); } return(webProxy); }
private static IWebProxy GetProxy() { // Ensure TLS 1.2 is enabled if (!ServicePointManager.SecurityProtocol.HasFlag(SecurityProtocolType.Tls12)) { ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; } if (webProxy == null) { // Uses HttpEnvironmentProxy class to mimic .NET Core behavior HttpEnvironmentProxy.TryCreate(out webProxy); } return(webProxy); }