Mohamadshirzad
New member
- Joined
- Feb 11, 2024
- Messages
- 2
- Programming Experience
- 3-5
Hi, I have a code which in windows 10 works properly but in windows 7 ,I recieve the error :
An error occurred while sending the request. System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar) mscorlib
My code:
```
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
string endPoint = "login";
string Url = $"{BaseUrl + endPoint}?username={getDomain.username}&password={getDomain.password}";
using (var httpClient = new HttpClient())
var httpresponse = await httpClient.GetAsync(Url);
```
Logger.Log.Api(Logger.LogStatus.Success, "Getting " + nameof(GetDomain));
httpClient.DefaultRequestHeaders.Add("Domain", "null");
httpClient.DefaultRequestHeaders.ConnectionClose = true;
var httpresponse = await httpClient.GetAsync(Url);
An error occurred while sending the request. System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar) mscorlib
My code:
```
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
string endPoint = "login";
string Url = $"{BaseUrl + endPoint}?username={getDomain.username}&password={getDomain.password}";
using (var httpClient = new HttpClient())
var httpresponse = await httpClient.GetAsync(Url);
```
Logger.Log.Api(Logger.LogStatus.Success, "Getting " + nameof(GetDomain));
httpClient.DefaultRequestHeaders.Add("Domain", "null");
httpClient.DefaultRequestHeaders.ConnectionClose = true;
var httpresponse = await httpClient.GetAsync(Url);