All Questions
Tagged with httpresponse .net
74 questions
0
votes
2
answers
69
views
Get Response on a WCF client that get an HTTP 400 response code
I'm using next code (in .NET 7) as a client to an Java SOAP Web Service that I have no control:
namespace ActuacionMov
{
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft....
0
votes
1
answer
900
views
How to get HttpResponseData in middleware after executing the Azure function?
Hi i'm trying to print in console the HttpRequestData and the HttpResponseData using a middleware for azure functions (Isolated).
I can get correctly the value for HttpRequestData but the value for ...
1
vote
0
answers
28
views
System.Outofmemoryexception in windows service GraphQl post request
I have a windows service running once per day that gets some information in a GraphQl post request like so:
try
{
JObject json = JObject.Parse(jsonQuery);
...
0
votes
0
answers
148
views
In C# HttpResponse, when does the response stream starts to be sent to the client?
I am using streams in my http response and was wondering when the stream starts to be sent to the client that sent the request.
I thought it was sent when the response was returned but one of my ...
0
votes
2
answers
139
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
533
views
Asp.net C# How to send file and message to client?
1- I would like to send a .zip folder with password to client
and
2- send the password to the bottom of the user's page.
and
3- send a warning to raise security awareness to user
In my HttpResponse, I ...
0
votes
0
answers
123
views
Intercepting requested file path & Open file from different source in new tab
I have 4.7.2 application where on anchor tag we have file link like 'www.abc.com/a.txt'. If I click it file is opening in new tab.
But now expected result is - When user hit that link, I want to ...
2
votes
1
answer
5k
views
How to access Content-Disposition header in HttpClient response
I want to download a file from a server and save it with the filename suggested by the server (using Content-Disposition header).
I am using HttpClient to download the file.
The problem is that I ...
4
votes
0
answers
2k
views
Convert HttpResponseMessage to HttpResponseData to return from azure function
I have an azure function .net5 .In this function I use httpclient created by IHttpClientFactory. HttpClient methods like post,put etc. return HttpResponseMessage .I need to return this data from ...
0
votes
0
answers
306
views
Populate data into an excel file and return as a response in WEB API (C#)
Is there any way we can populate data into excel in Web API (in .net 4.7 framework not .net core) and return the result in excel format as part of GET request?
I am totally new to this. please guide ...
0
votes
1
answer
90
views
Why do goo.gl short URLs not return the expected status code of 301?
When I make a HttpWebRequest to a URL with AllowAutoRedirect set to false, I expect a response with StatusCode "Moved" or "Moved Permanently". I am using .NetFramework , and if I use .NetCore, it ...
0
votes
0
answers
315
views
How to add CRC32 hash to the data returned as ByteRangeStreamContent?
I receive request to receive file content from WebApi.
The request can also contain range header and so for that I use ByteRangeStreamContent to generate the content and then finally send this ...
2
votes
1
answer
4k
views
How do I convert a string into an HTTP Response in C#?
{
"AdditionalProcessCardSwipeResponseData": null,
"CustomerTransactionID": "",
"ProcessCardSwipeOutputs": [
{
"AdditionalProcessCardSwipeResponseData": null,
...
0
votes
0
answers
137
views
.net core httpclient handling response with file attached
I am trying to get a file from a response that has been wrapped with a multipartformdata
here is an example of response
----------------------------584934499238183576109185
Content-Disposition: form-...
0
votes
0
answers
200
views
How to pass byte[] data and get response from client?
I have image in the form of byte[] data and code to pass byte data to get response from client. I need help in putting them together
I tried to use the code where I have my byte data but the async ...
1
vote
0
answers
817
views
HttpResponse Set Cookies
I'm making a POST request to Server A from Server B, Server A should return a cookie along with the HttpResponse, but it is never set.
What should i do ? Is there some middleware stuff i should be ...
0
votes
1
answer
248
views
.net long running httpwebrequest closing the connection?
The goal is to make an http request to a service that could take over an hour to respond.
I created a httpwebrequest and sent the request body fine,
then I used:
var ar = BeginGetResponse(null, null)...
0
votes
0
answers
24
views
In which property I should return long diagnostic message in the HTTPResponse?
I return 200 when my service is OK and other code when it is not with the description what is wrong.
I use HTTPResponse.StatusDescritpion to put diagnostic info there, however there is length ...
0
votes
0
answers
107
views
Change/update cookie value upon request
Trying to update an existing cookie on a site.
Here is what i have tried:
Private Sub UpdateCookie()
Dim cookieContainer As CookieContainer = New CookieContainer()
Dim CookieChange As ...
0
votes
0
answers
323
views
How to get the extension from ContentDisposition [duplicate]
In my c# code, I am trying to get filename from content disposition as the content type is application/octet-stream.
But for some urls, the content disposition filename contains spaces or non ascii ...
1
vote
0
answers
5k
views
converting an object to HttpContent [duplicate]
While converting an object to HttpContent , compilation succeeds. But while running I am getting below error.
Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, ...
1
vote
3
answers
9k
views
ReadAsAsync deserializing HttpResponseMessage result
This queston may possible duplicated but I am calling a service as the following below :
HttpClient httpClinet = new HttpClient();
httpClinet.DefaultRequestHeaders.Accept.Clear();
httpClinet....
0
votes
0
answers
36
views
Get HTTPWebResponse details after sending request
Using .Net Framework's System.Diagnostics library, i want to simulate something similar to what i'm getting using JMeter. Basically i want to be able to send an HTTPWebRequest and from the response, i ...
0
votes
0
answers
240
views
Randomized issues with HttpResponseMessage being Unable to connect to remote host
Problem
I am working with .NET and C#. I am parsing a list of messages through a foreach loop to send these messages one-by-one (as per endpoint requirements) to a target endpoint as such:
foreach (...
0
votes
0
answers
31
views
IE presenting file download before request is complete
I'm attempting to present a file for download to the browser and I'm having a weird issue whereby Internet Explorer is presenting the file download to the user before the HTTP request is complete.
...
1
vote
2
answers
2k
views
Returning single object and string from web api controller method
I am in a situation where i need to return the single object along with string .. I am very new to web api and just could not be able to figure it out how to return multiple parameters ..
below is ...
1
vote
1
answer
999
views
IIS web response connection forcibly closed issue
I have client desktop app and web service deployed on external server (IIS). Communication between them is based on HttpWebRequest and HttpWebResponse.
This code was working fine on IIS 8.0 and after ...
0
votes
1
answer
2k
views
Web API get Version Info when base url is called
How can i send Version Info and few other values when WebApi's base URL is called.
Ex: http://199.169.818.513/api is the base url for my webapi.
When i enter the url i would like to receive a ...
0
votes
1
answer
347
views
"The remote host closed the connection" error for HttpResponse.Write
I've inherited an old website that has a feature for downloading an excel document of user records. The following code is causing a "The remote host closed the connection. The error code is ...
0
votes
2
answers
98
views
Content type in HTTP call
My HTTP Put call response is printed by the following code.
HttpResponseMessage response = await client.PutAsync("https://restapi.surveygizmo.com/v4/survey/2692209/surveypage/3/surveyquestion?", ...
0
votes
0
answers
49
views
Setting a cookie with WEB API 2 [duplicate]
im trying to set a cookie from within my WEB API controller. I've followed the following tutorial: HTTP Cookies in ASP.NET Web API
this is the code i got:
[Route("api/user/SetCookie")]
[...
2
votes
1
answer
6k
views
C# Deserializing HttpResponseMessage to Object
I'm having some problem deserializeing a HttpResponseMessage into an object.
The problem is that when the object should have deserialized all fields are null, no exceptions are thrown.
HttpContent ...
-2
votes
1
answer
72
views
Save inside any folder instead in Desktop
Code:
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=pdfpage.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
The above code ...
1
vote
0
answers
790
views
Trying to read api response in global.asax
trying to read HttpContext.Current.Response in Application_EndRequest at global.asax. I tried using filters, but the CanRead and CanSeek objects are always set to false.
1
vote
1
answer
3k
views
Convert HttpWebResponse to HttpResponse
In C# or VB.Net, there is a way to translate an HttpWebResponse object to an HttpResponse, or get directlly an HttpResponse from a HttpWebRequest instance?
Example of what I try to do (it does not ...
1
vote
2
answers
1k
views
BeginFlush seems to work synchronously
I'm trying to use HttpResponse BeginFlush and EndFlush methods in order to make the flush async, which means my worker thread won't being used while flushing to the stream.
However it seems that the ...
0
votes
1
answer
1k
views
Get Web Response Status Code properly Asynchronously
I'm searching for a solution in C# or else VB.Net for this problem.
Using a WebClient I would like to retrieve the server response of UploadValuesAsync method asynchronously but I can't figure it ...
0
votes
1
answer
769
views
Get Web Response Status Code properly
I'm using Imgur's API to upload an image file anonimouslly.
The problem is with the function below, I'm trying to retrieve and parse the response code on the Select Case, but if something goes wrong (...
1
vote
1
answer
1k
views
.NET - Using "Response.BinaryWrite()" makes IE11 close
I have an ASP.NET page and a c# method that takes a memorystream (of an excel-file) and then uses the HTTPResponse-class to stream this file, in binary, to the browser.
public static void ...
1
vote
0
answers
559
views
Root element is missing using Xdocument
Using the below code i get "Root element is missing." on certain requests sent but using the exact same data criteria:
HttpWebRequest WebRequest = (System.Net.HttpWebRequest)System.Net.WebRequest....
1
vote
2
answers
2k
views
Get blob from SQL and write to browser for download
ASP / .NET 3.5 & SQL Server 2005
I'm trying to download a blobbed PDF from our SQL database, then without physically writing the file anywhere, output the file and download to user with the "Save ...
1
vote
2
answers
1k
views
How to cache image returned by HttpResponseMessage
I have a problem with caching images returned by HttpResponseMessage.
Files are accessed by urls:
http://localhost:[service port]/[file GUID]?Adapter=[adapter type]
eg:
http://localhost:59292/...
3
votes
1
answer
726
views
.NET web crawler needs to measure Time To First Byte of HttpWebResponse
I have written a web crawler application that monitors a website, checking for issues. Each time it visits a page I want to capture the Time To First Byte (i.e. the time between making the request and ...
12
votes
1
answer
43k
views
How to add the Content-Length,Content-Type and Last-Modified to the HTTP Response Message Header
How to add the Content-Length,Content-Type and Last-Modified to the HttpResponseMessage Header using .net.
I need to append the all these values manually to the response after adding these fields i ...
10
votes
2
answers
13k
views
What's the difference between HttpResponseMessage and HttpWebResponse?
They both seem to be different ways of handling responses to the client.
More detail about my problem: I have a server in which when I receive a request from a client I want to call a second server ...
1
vote
1
answer
1k
views
HttpContent, HTTPResponseMessage cannot be resolved - imported to the ASP project
I wanted to create project following that tutorial: http://www.strathweb.com/2013/01/asynchronously-streaming-video-with-asp-net-web-api/
I created Web Application in Visual Studio 2013. Copied the ...
1
vote
0
answers
310
views
unable to decode Icelandic dual byte character in response string of .net appliaction
I have an application build on c#. here is the snippet of my code
private void ProcessRequest(IAsyncResult result)
{
HttpListenerContext context = httpListener.EndGetContext(result);
...
1
vote
1
answer
389
views
Correct approach for multiple small writes to HttpResponse using async/await with .net 4.5
I'm trying to implement my HTTP responses to be fully asynchronous (with async/await).
This is a great simplification, but let's assume I have multiple small writes I need to make:
for (int i=0; i&...
0
votes
3
answers
4k
views
Response.Redirect from a page inside a folder of web solution?
In my solution i have a folder FIRE in which i have a page.I am using respose.redirect to handle my error to another page Error.aspx.
I am writing
catch (System.Exception ex)
{
//DisplayError(ex)...
4
votes
2
answers
709
views
Use HttpResponse to upload data in Silverlight
How to use asynchronous bidirectional binary upload and download of data in Silverlight?
I need to upload my binary file to the server and then >
Get the answer also as binary file from server
My ...