I try request site page from ConsoleApp:
static void Main(string[] args)
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
var handler = new HttpClientHandler
{
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
,
AllowAutoRedirect = false
};
using (var client = new HttpClient(handler))
{
var response = client.GetAsync("https://lk.fssprus.ru/ds_cabinet/action/login");
var httpResponseMessage = response.Result;
var content = httpResponseMessage.Content.ReadAsStringAsync();
Console.WriteLine(content.Result);
}
Console.ReadKey();
}
and get this error:
System.AggregateException HResult=0x80131500 Message=One or more errors occurred. Source=mscorlib StackTrace: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task
1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task
1.get_Result() at ConsoleApp8.Program.Main(String[] args) in C:\Projects\FsspConnectTest\ConsoleApp8\Program.cs:line 26This exception was originally thrown at this call stack: System.Net.HttpWebRequest.EndGetResponse(System.IAsyncResult) System.Net.Http.HttpClientHandler.GetResponseCallback(System.IAsyncResult)
Inner Exception 1: HttpRequestException: An error occurred while sending the request.
Inner Exception 2: WebException: The request was aborted: Could not create SSL/TLS secure channel.
I can't resolve this problem
Update: I test on Windows 10 and it's work perfect, but on my Windows 8.1 not work. What need install for Windows 8.1?
ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;
? – Selim Yildiz