Click here to Skip to main content
15,799,183 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The following Code works on another part, but here when the postasync it is executed its return to the try again and again. Any Help pls?
	HttpClientHandler insecureHandler = DependencyService.Get<ihttpclienthandlerservice>().GetInsecureHandler();
	HttpClient client = new HttpClient(insecureHandler);
	HttpClient client = new HttpClient();
	var data = new FormUrlEncodedContent(new[]
		new KeyValuePair<string, string="">("FechaRegistro",  p0),    
		new KeyValuePair<string, string="">("TipoGasto", p2),
		string url = "";       
		client.BaseAddress = new Uri(url);
		var response = await client.PostAsync(url, data); 
		if (response.IsSuccessStatusCode)
// incomplete

What I have tried:

I had checked Api Manual, c# tutorial and other part of my app where it is working
Updated 22-May-23 5:07am
Graeme_Grant 19-May-23 23:48pm    
What is the exception telling you? The answer will be there! Post usually requires authentication first.
Luis M. Rojas 20-May-23 15:28pm    
Nothing, never get there, only try.. postasync, try and postasync
Richard Deeming 22-May-23 3:36am    
That would suggest you're trying to post from an action to itself recursively.

1 solution

The only solution was to insert the in the button_click even.
Why? I do not know.
Share this answer
Richard Deeming 23-May-23 3:42am    
Since you've not explained your solution clearly, nobody else knows either. Insert the what in the button_click event?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900