https request with HttpClient RRS feed

  • Question

  • Hello,

    i try to develop a Client(WindowsPhone8.1) Server Connection that used a SSL certificate. But it is not working. (statuscode 404)

    If i use my Browser as a Client, it runs perfectly.

    here the code:

                    // Read the contents of the Certificate file
                    Uri certificateFile = new Uri("ms-appx:///Assets/TestSignedByCA.cer");
                    Windows.Storage.StorageFile file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(certificateFile);
                    Windows.Storage.Streams.IBuffer certBlob = await Windows.Storage.FileIO.ReadBufferAsync(file);
                    // Create an instance of the Certificate class using the retrieved certificate blob contents
                    Windows.Security.Cryptography.Certificates.Certificate rootCert = new Windows.Security.Cryptography.Certificates.Certificate(certBlob);
                    // Get access to the TrustedRootCertificationAuthorities for your own app (not the system one)
                    Windows.Security.Cryptography.Certificates.CertificateStore trustedStore = Windows.Security.Cryptography.Certificates.CertificateStores.TrustedRootCertificationAuthorities;
                    // Add the certificate to the TrustedRootCertificationAuthorities store for your app
                catch (Exception oEx)
                    // Catch and report exceptions
                    System.Diagnostics.Debug.WriteLine("Exceptionng cert: " + oEx.Message);
    //On click a button
    HttpClientHandler aHandler = new HttpClientHandler();
    //aHandler.ClientCertificateOptions = ClientCertificateOption.Automatic; -test
                using (HttpClient client = new HttpClient(aHandler))
                    client.BaseAddress = new Uri("");
                    StringContent content = new StringContent("hallo, ich bin eine App!");
                    HttpResponseMessage response = await client.PostAsync("index/", content);

    I hope some one can help me ...

    and sry for my bad english

    • Edited by CoooderKing Thursday, July 30, 2015 12:50 PM
    Thursday, July 30, 2015 12:45 PM