title: One or more errors occurred (an error occurred while sending the request) - Xamarin.Forms
body: <p>I'm currently in development to create an application with Xamarin.Forms to manage notifications in an intranet.<br>
  So I have a button "Connection" on the main page which connects to a webservice to verify the login and the password of the user first.<br>
  My problem is the connection to the webservice always failed.  </p>
  
  <p>I tested the webservice with postman and it's ok ; I get a response, but when I try it with the app in visual studio (UWP or Droid projects), an exception occurres each time and I don't know why.</p>
  
  <p>This is my code :  </p>
  
  <pre><code>private string WebServiceAuthentication()  
  {  
      string url = "https://chlevinatier.agiir-portail.com/api/jsonws/AlertesPortail-portlet.portal/check-authentication";  
      string login = "test";  
      string password = "test";`
  
      using ( HttpClient client = new HttpClient() )
      {
          client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue( "Basic", "tjhGjfM1" );
  
          try
          {
              return client.GetAsync( $"{url}?login={login}&amp;password={password}" ).Result.Content.ReadAsStringAsync().Result;
          }
          catch ( AggregateException ae )
          {
              ae.Handle( ( x ) =&gt;
              {
                  if ( x is HttpRequestException )
                  {
                      HttpRequestException hre = x as HttpRequestException;
                      Debug.WriteLine( $"Data : {hre.Data}\nHelpLink : {hre.HelpLink}\nHResult : {hre.HResult}\nInnerException : {hre.InnerException}\nMessage : {hre.Message}\nSource : {hre.Source}\nStackTrace : {hre.StackTrace}" );
                  }
  
                  return false;
              });
  
              return string.Empty;
          }
          catch ( Eception e )
          {
              Debug.WriteLine( $"Data : {e.Data}\nHelpLink : {e.HelpLink}\nHResult : {e.HResult}\nInnerException : {e.InnerException}\nMessage : {e.Message}\nSource : {e.Source}\nStackTrace : {e.StackTrace}" );
              return string.Empty;
          }
      }
  }  
  </code></pre>
  
  <p>When I clicked on the button "Connection", I get this result on the debug screen on visual studio :</p>
  
  <pre><code>*******************************************************************************
  &gt;Data : System.Collections.ListDictionaryInternal  
  &gt;HelpLink :  
  &gt;HResult : -2147012851  
  &gt;InnerException : System.Runtime.InteropServices.COMException (0x80072F0D): Le texte associé à ce code d’erreur est introuvable.
  
  &gt;L'autorité de certification n'est pas valide ou correcte
  
  &gt;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)  
  &gt;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
  &gt;   at System.Net.Http.HttpHandlerToFilter.&lt;SendAsync&gt;d__4.MoveNext()  
  
  --- End of stack trace from previous location where exception was thrown ---  
  
  &gt;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)  
  &gt;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)  
  &gt;   at System.Net.Http.HttpClientHandler.&lt;SendAsync&gt;d__86.MoveNext()  
  
  &gt;Message : An error occurred while sending the request. 
  &gt;Source : System.Net.Http  
  &gt;StackTrace :  
  &gt;at System.Net.Http.HttpClientHandler.  &lt;SendAsync&gt;d__86.MoveNext()  
  
  --- End of stack trace from previous location where exception was thrown ---  
  
  &gt;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)  
  &gt;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)  
  &gt;   at System.Net.Http.HttpClient.&lt;FinishSendAsync&gt;d__58.MoveNext()  
  *******************************************************************************
  </code></pre>