Dotnet application is built with dotnet 4.5. On a few system, we are getting this error while connecting to the web server where few changes were made in SSL recently.
Web server TLS only 1.2 https://drive.google.com/open?id=1Z0S-MWugDZdQrIy3BnquooB0ZX7veIVT
Client side code.
WebRequest webRequest = WebRequest.Create(strUrl);
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.Method = "Get";
if (strUrl.StartsWith("HTTPS", StringComparison.OrdinalIgnoreCase)) ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
using (WebResponse webResponse = webRequest.GetResponse())
{
if (webResponse == null) return blnResult;
using (StreamReader sr = new StreamReader(webResponse.GetResponseStream()))
{
strSuccess = sr.ReadToEnd().Trim();
blnResult = true;
}
}
As soon as I compile it with framework 4.6.2 it works.
Why it is working on few system with same 4.5 compiled EXE and on few system it needs to be compiled with 4.6.2?
WebClient class works fine with 4.5 version of dotnet framework. Only WebRequest is not working.