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.
171
questions
0
votes
0
answers
38
views
How can I save an HttpResponseMessage as binary?
From a GET API I receive JSON content with HttpResponseMessage. I wish to save that attachment as binary in my SQLite database. How can I do this and open it for the user to view?
{"Version":...
0
votes
0
answers
47
views
CreatedAtAction is returning Location as null from API to the client app (.NET 8, Blazor)
I am somewhat of a beginner so bear with me.
I have an HttpPost-method in an API, that makes use of the CreatedAtAction-method for the http-response:
[HttpPost]
public async Task<ActionResult<...
0
votes
2
answers
135
views
HttpClient for calling REST API service is not working
This is the obsolete function - call the function with :
string requestData = RestClient.JiraRequest(buildFilter());
Function:
public static string JiraRequest(string api)
{
string data = string....
0
votes
0
answers
199
views
Azure Function app API call with HttpRequestMessage
I have an Azure function app that calls a Web API using System.Net.Http.HttpRequestMessage.
The URLs were changed from their side so I had to update all different paths.
I updated the URLs, ...
1
vote
2
answers
263
views
How can I Mock HttpResponseMessage SendAsync in VB.NET?
I have found literally a hundred posts on how to do this in C#, but not a one on how to do it in VB.Net. Every attempt to translate these methods into VB.NET has failed. It seems to boil down to the ...
0
votes
1
answer
527
views
Prepare HttpResponseMessage to return file from Web API, not getting expected results
So, I'm stumped on something, and I have this down to the bare minimums as best I can, but complete otherwise. I'm working in C#. I have an C#.net WebAPI project AND a C#.net WPF application as the ...
2
votes
2
answers
1k
views
Error when modifying response headers in middleware
I'm trying to modify the response headers in some middleware after it has finished in the controller, but I'm getting an error message:
System.InvalidOperationException: Headers are read-only, ...
0
votes
1
answer
50
views
Reading custom httpHeader with HTTPURLResponse
let task = URLSession.shared.dataTask(with: url) { _, response, error in
if let error {
print(error.localizedDescription)
return
}
if let response = ...
0
votes
0
answers
129
views
Getting and Sending cookies with HttpRequestMessage using vb.net
I have been through many articles here on StackOverflow and on Microsoft's own website, but I can't seem to find the correct, working solution.
I make a request to a website, which it returns two ...
0
votes
0
answers
14
views
HttpRsponseMessage to Excel is succesful in Postmna but has no data
I created method that aquires data and converts it to excel file.
result, file and fileContent are properly set and have values, however there is no attachment or data in Postman:
StatusCode: 200, ...
0
votes
1
answer
560
views
Is there a way to set an empty Allow header that is not omitted in the response?
I have a .net service endpoint to return a list of entities with a GET request. However I do require an OData filter option to be defined, as I don't support a query for all the entities. If a request ...
0
votes
0
answers
125
views
c# HttpResponseMessage GetAsync return empty content on page with meta tag refresh
I want to download a zip file from url. But the url (https://petra.assurance-maladie.fr/fs/index.PnS?reqid=230620085933huRgfH9fPQwyDDqpJTw2B7d997a) doesn't download the zip directly, there is a ...
1
vote
2
answers
291
views
How correctly return string content from Web APIs service on ASP.Net
I am developing a Web API service on ASP.NET (C#).
[HttpPost, Route("add_role")]
public async Task<HttpResponseMessage> addRole(string roleName, string roleDescription)
{
var ...
0
votes
2
answers
113
views
ERR_CONTENT_DECODING_FAILED when trying to return gzip with HttpResponseMessage
Getting 'ERR_CONTENT_DECODING_FAILED' in the browser when running:
HttpResponseMessage response = Request.CreateResponse();
response.Content = new StringContent("...
0
votes
1
answer
222
views
Download PDF using HTTPResponseMessage returns Blank PDF
Create one pdf using iTextSharp C#, then download the same PDF. If tried to download the PDF getting blank page. What is wrong in my Code, assist me on this.
Here using PDF Writer created pdf file and ...