How do validate https?

Oct 8, 2013 at 10:15 PM
Edited Oct 8, 2013 at 10:16 PM
Hey,

how can I validate https from your Prerequisites?
// Validate HTTPS
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
I tested it like this:
using System.Net;
using System.Net.Security;
using FritzTR064.Generated;

...

ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;

string abc;
Contact service = new Contact("https://192.168.2.1");
service.SoapHttpClientProtocol.Credentials = new NetworkCredential("USERNAME", "PASSWORD");

service.GetPhonebookList(out abc);

MessageBox.Show(abc);
but there are two errors (unfortunately in German):
1 Der Operator '+=' kann nicht auf Operanden vom Typ
'System.Net.Security.RemoteCertificateValidationCallback' und 'lambda-Ausdruck'
angewendet werden. D:\DATEN\Visual Studio 2012\Projects\Softphone_v1\Softphone_v1
\forms\frm_main.cs 122 13 Softphone_v1

2 Eine lokale Variable mit dem Namen 'sender' kann in diesem Bereich nicht deklariert
werden, weil dadurch 'sender' eine andere Bedeutung erhalten würde, was bereits im
Bereich 'übergeordnet oder aktuell' in anderer Bedeutung verwendet wird. D:\DATEN\Visual
Studio 2012\Projects\Softphone_v1\Softphone_v1\forms\frm_main.cs 122 73 Softphone_v1
Google gave me some other options to implement the ServicePointManager but always the same problem.

I hope that someone can help me to implement the code for validate https?

Thank you !