Exemple #1
0
        /// <summary>
        /// Private constructor, private to prevent direct instantiation
        /// </summary>
        private ConnectionManager()
        {
#if NET_4_5 || NET_4_5_1
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
#else
            if (SDKUtil.IsNet45OrLaterDetected())
            {
                ServicePointManager.SecurityProtocol = (SecurityProtocolType)0xC00;
            }
            else
            {
                this.logTlsWarning = true;
            }
#endif
        }
Exemple #2
0
        /// <summary>
        /// Private constructor, private to prevent direct instantiation
        /// </summary>
        private ConnectionManager()
        {
#if NET_4_5 || NET_4_5_1
            ServicePointManager.SecurityProtocol = ServicePointManager.SecurityProtocol | SecurityProtocolType.Tls12;
#else
            if (SDKUtil.IsNet45OrLaterDetected())
            {
                try
                {
                    ServicePointManager.SecurityProtocol = ServicePointManager.SecurityProtocol | (SecurityProtocolType)0xC00;
                }
                catch (NotSupportedException)
                {
                    logger.Warn("Unable to set HTTPS connection to use TLSv1.2. Please update your .NET application to target a framework that supports TLSv1.2.");
                    this.logTlsWarning = true;
                }
            }
            else
            {
                this.logTlsWarning = true;
            }
#endif
        }