You can use the following code:
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true;
Be aware that this code does just accept every certificate and it is not only active for one request but for all requests. You should think before you use this code. But for development convenience or on a test system it might be ok to make your program easier to install and test.