Questions tagged [httpcontent]

79 questions
0
votes
1 answer

Nlog Log IP Address from NetCore Library Project

I have a VS 2017 solution with multiple projects, I have a separated project with the NLog methods to use it from other projects for not include NLog in all projects. NetCore Rest API NetCore Infraestructure NetCore Database And persistence NetCore…
JuanDYB
  • 590
  • 3
  • 9
  • 23
0
votes
0 answers

Invalid HTTP Post Request to Authentication Server

I try to do a POST request to my authentication server which provides a JWT for me. But I don't get the values packed into the request. The code line 'var content = new FormUrlEncodedContent(values);' seems to have no effect. Does anybody know what…
dafna
  • 893
  • 2
  • 10
  • 21
0
votes
1 answer

Setting Content type with Default Request Headers

When using HttpClient, I have read examples (such as this example) that uses DefaultRequestHeaders to set the content type (such as "application/json") of a Post request. I tried to do something like this, but it failed. The API I am sending…
KansaiRobot
  • 7,564
  • 11
  • 71
  • 150
0
votes
0 answers

How to call POST method from API using HttpClient?

I am trying to use the HttpClient class to call a POST method from my API which is supposed to add Server information to a DB. The way I'm trying to call it is below. But when I step through it to debug it steps through my if statement for…
Zybrith
  • 1
  • 1
  • 1
0
votes
2 answers

No content when using PostAsync to post JSON

Using the code below, I've managed to create a jsonArray with the following format:[{"id":3},{"id":4},{"id":5}] var jArray = new JsonArray(); int numOfChildren = 10; for (int i = 0; i < numOfChildren; i++) { if…
kubiej21
  • 700
  • 4
  • 14
  • 29
0
votes
1 answer

Xamarin droid challenges when extending HTTPContent

My question is a follow up on: How can I calculate progress with HttpClient PostAsync? This solution works perfectly. Just remember, if you are using Xamarin, to include the Microsoft.Net.Http nuget package in the .iOS project otherwise you'll get…
0
votes
1 answer

How can I pass parameter of type HttpContent in web api?

The back story is I have a web api that simply serves as a gateway to invoke external services. The reason for this is I don't want to expose the real business API to external services. So, in this gateway controller, it simply receives the…
Nico
  • 497
  • 1
  • 4
  • 15
0
votes
1 answer

httpclient header + content joined PostAsyn

I am trying to make a PostAsync request with c#. The following is my code. static void Main(string[] args) { CookieContainer cookies = new CookieContainer(); HttpClientHandler handler = new HttpClientHandler(); …
Puzzle
  • 25
  • 2
  • 2
  • 7
0
votes
2 answers

HttpResponseMessage.Content.Header ignoring charset setting in meta tag in html source

I have just posted this question, which answer came right away. It, in turn, creates the following new question: If my understanding is correct, the StreamContent object, from HttpResponseMessage, is created upon making an HTTP request via…
Veverke
  • 9,208
  • 4
  • 51
  • 95
0
votes
1 answer

Call WEB API method with Simple Type parameters Method from Winform APP

I am fairly new to Web API so please forgive a stupid question I have a Web API 2 method...... [System.Web.Http.HttpPost] public MyAPIController AddItemToBasket(Guid b, Guid l, Guid a, Guid cid, int d, int p,…
AntDC
  • 1,807
  • 14
  • 23
0
votes
1 answer

Get HttpContent from HttpObject Netty - Java

i'm working with Netty. I have a HttpObject and i need the content (HttpContent). A cast don't work. What can i do then? Greetings Daniel
Daniel84
  • 1
  • 3
0
votes
0 answers

Cannot read response from GetAsync in HttpClient, I have strange signs instead of json

I have simple get request using HttpClient: response = await httpClient.GetAsync(uri); And in response.Content.ReadAsStringAsync() I have strange signs, while in Fiddler I can see normaly…
Robert
  • 2,571
  • 10
  • 63
  • 95
0
votes
1 answer

HttpResponseMessage System.InvalidOperationException

Quite a simple problem I've got that would be easy to solve I reckon for the brains. It's just a tried a different queries on Google and nothing popped up but hey that's why I am here. Here is the error:…
0
votes
1 answer

Calling REST from Windows Phone 8.1 using PostAsync, HttpClient & Json

My question is very similar to Calling MVC4 WebAPI methods from C# Metro UI Client using PostAsync, HttpClient & Json which was not sufficient for me to resolve my problem. Here is my code in a Windows Phone 8.1 project : using (var httpClient = new…
Jérôme Oudoul
  • 369
  • 1
  • 5
  • 14
0
votes
1 answer

Headers HttpContent 'System.InvalidOperationException'

Let me start by showing code: private async Task session() { string post = " "; HttpContent postContent = new StringContent( post, Encoding.ASCII, …
Aidan
  • 317
  • 1
  • 3
  • 17