Skip to content

Commit ef0501d

Browse files
committed
Probably going to fix Win2008R2 Telegram.Bot bug
1 parent 246848d commit ef0501d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

MedocUpdates/Program.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Windows.Forms;
66

77
using AppUpdater;
8+
using System.Net;
89

910
namespace MedocUpdates
1011
{
@@ -30,6 +31,21 @@ static void Main()
3031
return;
3132
}
3233

34+
// Fix for Telegram.Bot not being able to do something on Windows Server 2008 R2
35+
try
36+
{
37+
ServicePointManager.Expect100Continue = true;
38+
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls |
39+
SecurityProtocolType.Tls11 |
40+
SecurityProtocolType.Tls12 |
41+
SecurityProtocolType.Ssl3;
42+
}
43+
catch (Exception ex)
44+
{
45+
MessageBox.Show("MedocUpdates: Cannot set the security protocol type - TLS/TLS1.1/TLS1.2/SSL3 probably not supported\r\n" + ex.Message);
46+
return;
47+
}
48+
3349
ParsedArgs.SetArgs(Environment.GetCommandLineArgs());
3450
ParsedArgs.PrintArgs();
3551

0 commit comments

Comments
 (0)