I need to read a web page from my asp.net app (i use C# and Framework 4.6.1), as part of a bigger application. My code in local run fine, but when i upload it on my host (Aruba shared host) and try to read https://forumcommunity.net/ I get the error " The request was aborted: Could not create SSL/TLS secure channel"..while other sites are properly read (for example google, youtube, etc). Maybe is a problem of my host.. but i don't know where to start to solve the problem.. Thanks in advance for the help.
string Uri = TextBoxLink.Text;
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Uri);
request.Method = "get";
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream resSteam = response.GetResponseStream();
StreamReader sr = new StreamReader(resSteam);
TextBoxResult.Text = sr.ReadToEnd();
}
catch (Exception ex)
{
LabelError.Text = ex.Message;
}