Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

HttpClient Post Request with Xamarin Android

$
0
0

I am using the .NET HttpClient ( added ModernHttpClient ) in my Xamarin Android Application. I am making Http Post request to a Rest Service. My code is quite simple.

    using (var client = new HttpClient(new NativeMessageHandler()))
    {
        using (var multipartFormDataContent = new MultipartFormDataContent())
        {

            foreach (var keyValuePair in postParameters)
            {
                multipartFormDataContent.Add(new StringContent(keyValuePair.Value),
                    String.Format("\"{0}\"", keyValuePair.Key));
            }


            var result = client.PostAsync(postUrl, multipartFormDataContent).Result;

            return result.Content.ReadAsStringAsync().Result;
        }
    }

When I am on Wifi everything works fine.

When I switch to a 4G LTE connection for some reason only the small requests make it through ( a couple of bytes vs 60kb worth of data ) and eventually Timeout

I know that I can reach my service while on the 4G LTE connection.

I am not sure where to start troubleshooting this.

If anybody has run into this please share .. thanks


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>