views:

571

answers:

2

I want to disable "Alert window" that I get from login page of one HTTPS site with "untrusted certificate".

ServicePointManager is used for WebRequest/WebResponse:

> public static bool
> ValidateServerCertificate(object
> sender, X509Certificate certificate,
> X509Chain chain, SslPolicyErrors
> sslPolicyErrors) {
>     return true; }
> 
> ServicePointManager.ServerCertificateValidationCallback
> = new RemoteCertificateValidationCallback(ValidateServerCertificate);

but how can I use it with Webbrowser control?

+2  A: 

The ServicePointManager is for managed code; WebBrowser is a wrapper around shdocvw, so will almost certainly have a very different programming model.

if you can automate this (and I'm not sure that you can), I would expect to have to reference the COM version to get the full API (see: AxWebBrowser). WebBrowser only exposes a .NET-friendly subset of the full functionality - enough to get most common jobs done.

One other option might be to get the data yourself (WebClient / WebRequest / etc), and simply push that html into the WebBrowser - but this will mess up external links etc.

Marc Gravell
A: 

As noted by Marc Gravell, I don't believe that it is possible to use ServicePointManager or ServicePoint classes in the WebBrowser Control, nor do you need to though.

See my answer to your other post where you asked your original question.