Questions tagged [httpresponsemessage]

HttpResponseMessage refers to the C# public class that represents an HTTP response message including the status code and data. Use this tag for questions related to the public class.

HttpResponseMessage refers to the C# public class that represents an HTTP response message including the status code and data. Use this tag for questions related to the public class.

168 questions
1
vote
0 answers

AspNetCore / SignalR - Returning HttpResponseMessage from SignalR Hub Server results in InvalidDataException

I have two web applications. From one web application, I am trying to communicate with the other application via SignalR. I am sending data via SignalR using InvokeAsync and waiting for a result on the client. On the server, with the data sent, I am…
SylvainB2347
  • 349
  • 3
  • 7
1
vote
1 answer

Extension method not found when publishing ASP.NET MVC app

In an ASP.NET MVC application (.NET 4.7) I am using an extension method on HttpResponseMessage. This method is created in a .NET Standard 2.0 project. When debugging and using IIS Express, it is working just fine. But when publishing to a server,…
1
vote
3 answers

Set The Name of a ZipArchive Zip File In Web API

I can't seem to set a zip file's name from a web API in a HttpResponseMessage. I can successfully create the zip file using ZipArchive with all its content files, but when downloading it from client side (although it does return and open…
Jnr
  • 1,504
  • 2
  • 21
  • 36
1
vote
1 answer

How to download audio files (wav or mp3) from HttpResponseMessage Steam Content response in c#?

My code is below: URL = "https://abcde.com/api//export/1234.wav?type=wav"; HttpResponseMessage response = client.GetAsync(URL).Result; It's showing "StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.StreamContent" The…
Leo.Z
  • 11
  • 2
1
vote
2 answers

req.Content.ReadAsStringAsync().Result always returns null when accessed from browser (but not in Azure Portal)

Below contains my full code (Azure Function App on Azure Portal). Take extra attention on these two lines. var jsonContent = req.Content.ReadAsStringAsync().Result; log.LogInformation("jsonContent" + jsonContent); When I test the function using…
Tan En De
  • 331
  • 1
  • 3
  • 13
1
vote
0 answers

"Cloning" a HttpResponseMessage to a HttpResponse

For a project I need to build a "proxy" for an third party API because parts of the API should be blocked for an external party. Now I can use HttpClient to retrieve the information from the API but I need to send the information back using…
LiQuick.net
  • 189
  • 15
1
vote
1 answer

response.content.readasstringasync() to object

My problem is that I cannot extract an object sent by an API, despite I have the schema of the object either in the API or in the client. My code: public async Task Index() { HttpClient client = new HttpClient(); …
jalil monagi
  • 39
  • 1
  • 2
  • 9
1
vote
2 answers

Web API: Download Multiple Files Separately

I have a Web Api controller method that gets passed document IDs and it should return the document files individually for those requested Ids. I have tried the accepted answer from the following link to achieve this functionality, but it's not…
Md Aslam
  • 1,228
  • 8
  • 27
  • 61
1
vote
1 answer

'response' is null on at least one execution path in SonarQube

I'm using SonarQube for the first time to analyse the code. I have one method as below. public async Task SendRequest(HttpRequestMessage httpRequest) { HttpClient client = new HttpClient(); HttpResponseMessage response…
CrazyCoder
  • 2,194
  • 10
  • 44
  • 91
1
vote
0 answers

Response from OData API in .NetCore is well formed?

I have this function code made in a controller CustomEntityController of a CustomEntity Model from OData API public HttpResponseMessage Post([FromBody] CustomEntity entity) { HttpResponseMessage response = null; SecurityController sc = new…
lsalvatore
  • 101
  • 1
  • 11
1
vote
1 answer

object 'new HttpResponseMessage()' is not disposed along all exception paths

I have tired using statement after going through the links in stackoverflow but still couldnt figure the exact solution. using (MemoryStream stream = new MemoryStream(textAsBytes)) { using (HttpResponseMessage…
1
vote
1 answer

Posting an array to an Azure Function HTTP trigger is returning a 500 status code

I have the very simple Azure HTTP triggered function that receives a POST with the data: { "symbols": ["Azure1", "Azure2", "Azure3"] } And my Azure function is: #r "Newtonsoft.Json" using System.Net; using System.Linq; using…
Brett
  • 11,637
  • 34
  • 127
  • 213
1
vote
2 answers

Get Image From WebApi Error HttpResponseMessage

Hi I Have Method In Web Api Service For Get Personal Image public HttpResponseMessage GetPersonnelPicture( int personnelId) { JamsazERPLiteEntities db = new JamsazERPLiteEntities(); var fingerPrint =…
Mostafa Bagheri
  • 366
  • 2
  • 7
  • 19
1
vote
0 answers

How to resend HttpRequestMessage on c#. Cannot send a content-body with this verb-type

Hello! I have self host web proxy service Need to Substitute host:port and to resend public class HomeController : ApiController { [HttpGet] public HttpResponseMessage Index() { using (HttpClient client = new HttpClient()) …
1
vote
1 answer

How to read zipfile as StreamContent from httpResponseMessage?

I send a zipfile as a response.Content: [HttpGet] [Route("Package")] public async Task GetLogsPackage() { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); using (var stream =…
Lizabeth
  • 11
  • 3