Forum Xamarin.Forms


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.

System.Net.Http works fine in IOS. but not in Android

my application is connected to some web services it works fine before but lately IOS project receive the response with a Status code 200. but in Android statuscode 401 'Unauthorized' same code for both IOS and ANDROID

                        credCache.Add(new Uri("------"), "Digest", new NetworkCredential("user", "password"));

                        var HttpHandler = new HttpClientHandler();
                        HttpHandler.Credentials = credCache;
                        var httpClient = new HttpClient(HttpHandler);
                        var answer = httpClient.GetAsync(new Uri(app.Properties["endPoint"].ToString() + "isa_student/list_parameters/param")).Result;
                    -->    answer.EnsureSuccessStatusCode();

in this line a get this message bellow

     StatusCode: 401, ReasonPhrase: 'Unauthorized', Version: 1.1, Content: System.Net.Http.HttpConnection+HttpConnectionResponseContent,               Headers:
      Date: Thu, 09 Jan 2020 08:57:45 GMT
      Server: Apache/2.2.22
      Server: (Debian)
      WWW-Authenticate: Digest realm="", domain="/", qop=auth, algorithm=MD5, nonce="f6774c3386519e296fc6d5124380390a", opaque="94619f8a70068b2591c2eed622525b0e"
      Vary: Accept-Encoding
      Content-Length: 59
      Content-Type: text/html

Thank you for helping it's urgent


Sign In or Register to comment.