title: HttpClient getting timed out even after setting Timeout.Infinite
body: <p>i am using <code>HttpClient</code> to fetch the data from the server in <code>Xamarin Forms</code> using following code</p>
  
  <pre><code>public  Task&lt;HttpResponseMessage&gt; sendData(String url,String jsonData)
      {
  
          using (var client = new HttpClient())
          {
  
              var jsonContent = new StringContent(jsonData, System.Text.Encoding.UTF8, "application/json");
  
              client.Timeout = TimeSpan.FromMilliseconds(Timeout.Infinite);
              client.BaseAddress = new Uri(baseAddress);
  
              return  client.PostAsync(new Uri(url, UriKind.Relative), jsonContent);
          }
      }
  </code></pre>
  
  <p>Here i have used <code>Timeout.Infinite</code> as webservice is taking around 4 mins to return the response but although i have set the <code>Timeout.Infinite</code> app is throwing <code>Operation time out</code> exception. I tried with the various timeouts as well like  <code>240000ms</code>  but still getting operation timeout.</p>
  
  <p>However, when i try to fire the same request in postman it is working but yes returning the response after 4 mins of time. As it is a third party api, we can not change anything there.</p>
  
  <p>can anyone please suggest how can i forced the <code>HttpClient</code> to hold more for the response.</p>
  
  <p>Detail exception i am getting </p>
  
  <pre><code>{System.Net.Http.HttpRequestException: An error occurred while sending the request ---&gt; System.Net.WebException: The operation has timed out.
    at System.Net.HttpWebRequest+&lt;RunWithTimeoutWorker&gt;d__241`1[T].MoveNext () [0x000c5] in &lt;3e9b3e26c4694baab3f689687ad40612&gt;:0 
  --- End of stack trace from previous location where exception was thrown ---
    at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00020] in &lt;3e9b3e26c4694baab3f689687ad40612&gt;:0 
    at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in &lt;d4a23bbd2f544c30a48c44dd622ce09f&gt;:0 
  --- End of stack trace from previous location where exception was thrown ---
    at System.Net.Http.HttpClientHandler+&lt;SendAsync&gt;d__64.MoveNext () [0x0041d] in &lt;25ebe1083eaf4329b5adfdd5bbb7aa57&gt;:0 
     --- End of inner exception stack trace ---
    at System.Net.Http.HttpClientHandler+&lt;SendAsync&gt;d__64.MoveNext () [0x00478] in &lt;25ebe1083eaf4329b5adfdd5bbb7aa57&gt;:0 
  --- End of stack trace from previous location where exception was thrown ---
    at System.Net.Http.HttpClient+&lt;SendAsyncWorker&gt;d__49.MoveNext () [0x000ca] in &lt;25ebe1083eaf4329b5adfdd5bbb7aa57&gt;:0 
  --- End of stack trace from previous location where exception was thrown ---
    at SignodeMSA.WebService.HttpService+&lt;sendData&gt;d__13.MoveNext () [0x0009c] in D:\VsualStudioWorkspace\SignodeMSA\SignodeMSA\SignodeMSA\WebService\HttpService.cs:141 
  --- End of stack trace from previous location where exception was thrown ---
    at SignodeMSA.WebService.RestApi+&lt;sendDataSimple&gt;d__96.MoveNext () [0x000b3] in D:\VsualStudioWorkspace\SignodeMSA\SignodeMSA\SignodeMSA\WebService\RestApi.cs:199 }
  </code></pre>