Debug release and tested on hardware (Galaxy S3 Android 4.1.2, Nexus4
Android 4.2.2)
Stephan
Sent from my Windows Phone
------------------------------
From: Jonathan Pryor-2 [via Mono for
Android]<[email protected]>
Sent: 03.04.2013 01:58
To: Stephan Steiner <[email protected]>
Subject: Re: handling webservices with self-signed certificates
On Apr 2, 2013, at 7:04 PM, Stephan Steiner <[hidden
email]</user/SendEmail.jtp?type=node&node=5713093&i=0>>
wrote:
> I just sent this to Bryan -
>
> Try https://www.google.com/
>
> Still bombs out.
Still unable to reproduce. Is this a Debug or a Release app? If a Release
app, perhaps you need to enable the INTERNET permission?
Is this on hardware or the emulator? If the emulator, has the network been
disabled (F8 enables/disables)?
The following Works For Me™.
- Jon
using System;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using Android.App;
using Android.Runtime;
using Android.Widget;
using Android.OS;
namespace Scrach.NewBcl
{
[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;
}
}
[Activity (Label = "Scrach.NewBcl", MainLauncher = true)]
public class Activity1 : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.myButton);
button.Click += button_Click;
}
void button_Click(object sender, EventArgs e)
{
((Button)sender).Text = string.Format ("{0} clicks!", count++);
// var uri = new Uri (@"
https://wsklo2059.dragonslair.net:8090/IsAlive/");
// var uri = new Uri ("https://balthasar.jprl.com");
var uri = new Uri ("https://www.google.com/");
HttpWebRequest req = new HttpWebRequest (uri);
WebResponse res = req.GetResponse();
}
}
}
_______________________________________________
Monodroid mailing list
[hidden email] </user/SendEmail.jtp?type=node&node=5713093&i=1>
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
------------------------------
If you reply to this email, your message will be added to the discussion
below:
http://mono-for-android.1047100.n5.nabble.com/handling-webservices-with-self-signed-certificates-tp5713085p5713093.html
To unsubscribe from handling webservices with self-signed certificates, click
here<http://mono-for-android.1047100.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5713085&code=c3RlcGhhbi5zdGVpbmVyQGdtYWlsLmNvbXw1NzEzMDg1fC0xNjMyOTU2NzQy>
.
NAML<http://mono-for-android.1047100.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
--
View this message in context:
http://mono-for-android.1047100.n5.nabble.com/handling-webservices-with-self-signed-certificates-tp5713085p5713096.html
Sent from the Mono for Android mailing list archive at Nabble.com._______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid