System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;
private void TASK_DownloadStart() { // 開始下載 System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls; WebRequest request = WebRequest.Create(textBox_url.Text); WebResponse response = request.GetResponse(); Stream data = response.GetResponseStream(); string html = String.Empty; using (StreamReader sr = new StreamReader(data)) { html = sr.ReadToEnd(); } richTextBox_Log.AppendText(html); richTextBox_Log.ScrollToCaret(); }