Ssl issue related with time


#1

My service using twitter’s API for requests tweets from a specific user. This works correctly 23 out of 24 hours.
Every day at 2PM and 2AM by PST this service receives an error “The request was aborted: Could not create SSL/TLS secure channel”

That’s how service requests the tweets:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
const string RequestUriString = "https://api.twitter.com/oauth2/token";
            const string Format = "Basic {0}";
            string str6 = string.Format(Format, Convert.ToBase64String(Encoding.UTF8.GetBytes(Uri.EscapeDataString(stringToEscape) + ":" + Uri.EscapeDataString(str3))));
            string s = "grant_type=client_credentials";
           HttpWebRequest request = (HttpWebRequest)WebRequest.Create(RequestUriString);
            request.Headers.Add("Authorization", str6);
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded;charset=UTF-8";
            request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;

            using (Stream stream = request.GetRequestStream())
            {
                byte[] bytes = Encoding.ASCII.GetBytes(s);
                stream.Write(bytes, 0, bytes.Length);
            }
            request.Headers.Add("Accept-Encoding", "gzip");
            WebResponse response = request.GetResponse();
            using (response)
            {
                using (reader = new StreamReader(response.GetResponseStream()))
                {
                    JavaScriptSerializer serializer = new JavaScriptSerializer();
                    string input = reader.ReadToEnd();
                    response2 = serializer.Deserialize<TwitAuthenticateResponse>(input);
                }
            }
            string str9 = twitterUrl;
            HttpWebRequest request2 = (HttpWebRequest)WebRequest.Create(str9);
            string str10 = "{0} {1}";
            request2.Headers.Add("Authorization", string.Format(str10, response2.token_type, response2.access_token));
            request2.Method = "Get";
            WebResponse response3 = request2.GetResponse();

Could someone help me to avoid this error?