Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending multiple HTTP Response to a single HTTP Request in .NET

I am new to .NET and I want to develop the application which send multiple HTTP responses to the single HTTP Request.

Is there any way that I can store HTTP Handler on server which can be used when it is needed.

like image 812
Amit Shah Avatar asked Dec 07 '10 05:12

Amit Shah


People also ask

Can a HTTP request have multiple responses?

A HTTP request can have multiple 'responses', but the responses all have statuscodes in the 1xx range, such as 102 Processing. However, these responses are only headers, never bodies. HTTP/1.1 (like 1.0 before it) is a request/response protocol. Sending a response unsolicited is not allowed.

Can I send multiple responses for a single request?

No. In http, one request gets one response. The client must send a second request to get a second response.

What is HTTP response payload?

A "payload" in HTTP is always a partial or complete representation of some resource. We use separate terms for payload and representation because some messages contain only the associated representation's header fields (e.g., responses to HEAD) or only some part(s) of the representation (e.g., the 206 status code).

Can a TCP segment carry multiple HTTP requests?

With regard to a TCP connection, a single connection can be used for multiple HTTP requests, for example in case several images are being fetched from the same server. However, this still requires a FIFO queue of requests and responses. Thus, browsers prefer separate TCP connections per HTTP request.


1 Answers

You would break the HTTP standard by sending multiple responses to a request.

However, you can use Transfer-Encoding "chunked" which sends a response in multiple parts. In regular ASP.Net you would use Response.Flush() to achieve this.

I guess that you have to execute the ActionResult and send it manually with the response object to be able to send multiple parts in the same response.

like image 60
jgauffin Avatar answered Oct 11 '22 15:10

jgauffin