On Apr 2, 2013, at 12:28 PM, Stephan Steiner <[email protected]> wrote:
> Ran into this issue this afternoon: Create new android app with the following 
> code

I am unable to reproduce. Perhaps my server with unsigned cert differs somehow 
from yours? (I'm unable to use dragonslair.net, as it's inaccessible to me.)

What's plausible -- yet doesn't make any sense -- is if button_Click() were 
executed before ServicePointManager.ServerCertificateValidationCallback were 
assigned, that would explain your behavior. Though that doesn't seem possible.

In any event, I'd suggest moving the 
ServicePointManager.ServerCertificateValidationCallback initialization before 
your button.Click initialization. Or better, move it into an 
Application.OnCreate() method so that it's only initialized once per process:

    [Application]
    public class MyAp : Android.App.Application {
        public MyAp (IntPtr handle, JniHandleOwnership transfer)
            : base (handle, transfer)
        {
        }

        public override void OnCreate ()
        {
            ServicePointManager.ServerCertificateValidationCallback = 
validatedCertificate;
        }
        
        private bool validatedCertificate(object sender, X509Certificate 
certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
            return true;
        }
    }

 - Jon

_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to