Forum Cross Platform with Xamarin


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Xamarin Forms HttpWebRequest with Certificate

PhilippWegenerPhilippWegener USMember ✭✭


I have a Portable Project, which calls my asmx webservice.
I call the webservice with httpwebrequest and send an certificate to the Server.
In Android everything is working fine, but in iOS i cant send the certificate.
Did i have to use ModernHttpClient?

Following Code works in Android:

    HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("https://*****");
    req.Method = "POST";
    req.ContentType = "application/json";


    byte[] postDataAsBytesS = Encoding.UTF8.GetBytes(mobileJSON);
    Stream postStreamS = req.GetRequestStream();
    postStreamS.Write(postDataAsBytesS, 0, postDataAsBytesS.Length);

    WebResponse resS = req.GetResponse(); //Error in iOS
    postStreamS = resS.GetResponseStream();
    StreamReader srS = new StreamReader(postStreamS);

    string responseFromServerS = srS.ReadToEnd();

Everytime i send the request, i get an error back from Server.
What can i do?


Sign In or Register to comment.