In my webpart i am trying to call url to get me xml but i am getting error
The remote certificate is invalid according to the validation procedure. `WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.`
Here is how i am trying to access it
XmlDocument doc = new XmlDocument(); List<listXml> lt = new List<listXml>(); doc.Load("https://myexternalurl/list.xml");
I found this link but dont know where to put this in my webpart. It says to add this
ServicePointManager .ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
But i am not sure what to pass as sender,cert,chain,sslpolicyerrors. I want to avoid installing certificate on servers.