增加TLS兼容

This commit is contained in:
lxd 2025-05-07 14:22:11 +08:00
parent dda0aa0aa2
commit f2d00d0fa9
3 changed files with 49 additions and 30 deletions

View File

@ -354,6 +354,8 @@ namespace FlyDockTool
}
public static string PostMoths(string url, string param)
{
try
{
string strURL = url;
HttpWebRequest request;
@ -380,6 +382,18 @@ namespace FlyDockTool
}
return strValue;
}
catch (WebException ex)
{
MessageBox.Show("网络请求失败: " + ex.Message + "\\n状态: " + ex.Status);
return "";
}
catch (Exception ex)
{
MessageBox.Show("其他错误: " + ex.Message);
return "";
}
return "";
}
/// <summary>

2
mainForm.Designer.cs generated
View File

@ -200,7 +200,7 @@
this.MinimizeBox = false;
this.Name = "mainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "福乐云软硬件数据对接工具V1.1(2025042501)";
this.Text = "福乐云软硬件数据对接工具V1.1(2025050701)";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.mainForm_FormClosing);
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox2.ResumeLayout(false);

View File

@ -24,7 +24,12 @@ namespace FlyDockTool
private void Form1_Load(object sender, EventArgs e)
{
//兼容TLS
System.Net.ServicePointManager.SecurityProtocol =
System.Net.SecurityProtocolType.Ssl3 |
System.Net.SecurityProtocolType.Tls |
(System.Net.SecurityProtocolType)768 | // Tls11
(System.Net.SecurityProtocolType)3072; // Tls12
string CurrentDevice = ConfigurationManager.AppSettings["CurrentDevice"];
apiOptions.CurrentDevice = CurrentDevice;