Click here to Skip to main content
14,543,534 members
Rate this:
Please Sign up or sign in to vote.
See more:
So, my boss told me we need to download some data from another team's site -- within the company domain, it's trustworthy, right? -- but they have a bad certificate (wrong name for the server or some such).

I'm sure they'll get it straightened out by the time we need to get this feed into production (can you hear my eyes roll?).

Anyway, I'm working on the code, it's not difficult, but I have to deal with the system popping up a window prompting whether or not I really want to continue (gasp!).

So, what other options might there be to tell the system to ignore the error or otherwise trust the bad certificate?

.net 4.6.1

What I have tried:

I'm trying to use a System.Net.WebClient or System.Net.HttpWebRequest and neither is succeeding.
I have it working with a System.Windows.Forms.WebBrowser -- which is why I get a pop-up -- but I need the eventual solution to be hands-free.

I have the code for providing an always-true response from:
ServicePointManager.ServerCertificateValidationCallback
Which works in other situations, but not this one.
Posted
Updated 14-Dec-19 6:55am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Did you try to install offending certificate in the list of trusted sources for the account under which the program is running?
mmc -a
... add a component to the mmc to handle certificates
... etc.

I had to do this a few months ago to be able to access a wiki running in a private vm. I remember that the CA which signed the certificate had to be in the list of trusted authorities, too (and that could be true for all CAs up in the chain, eventually).
   
Comments
PIEBALDconsult 14-Dec-19 13:06pm
   
Nope, but I'll mention that to my boss.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100