Share via

Post request issue with some android devices (new or old) in Xamarin-forms cross platform project

Huynh 1 Reputation point
2020-12-24T20:03:17.837+00:00

I have encountered 404 error response when making Post requests to a specific API call on some Android devices. It does not happen with any of iOS devices. There are no error logs from the server-side. The issue was reported by some of the end-users. It does not happen all the time for some of those devices that encountered this issue, but a very small number of those devices actually encountered this issue 100% of the time when trying to make post request to said API. None of my test devices can't replicate the problem, so I can't think of any other way to try and solve this issue. Please advise.

Code snippet of the post request:

String postUrl = ConfigurationMyApp.MyAppBaseUrl + "api/MyAppApi/SaveData";
HttpContent contentPost = new StringContent(JsonConvert.SerializeObject(graniteSignOutForm), Encoding.UTF8, "application/json");            
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, postUrl);
    request.Content = contentPost;

HttpResponseMessage httpResponseMessage = client.SendAsync(request, HttpCompletionOption.ResponseContentRead).Result;
Developer technologies | .NET | Xamarin

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.