I am wanting to use something like HttpServerUtility.Execute
to execute an IHttpHandler
and write the handler response to a MemoryStream
that can then be parsed into an http response (functionally, I want access to the headers and the content returned).
Currently the HttpServerUtility.Execute
method has a parameter for a TextWriter
object (can be a StringWriter
object) but this only caters for requests that return a text/string body, also I cannot read the content-type header of the response (say for a text/css response). If say I had a handler that I wanted to execute that outputs an image the StringWriter
would not work as this deals with binary data.
Basically I want to execute one IHttpHandler
(could be a System.Web.UI.Page
) inside another IHttpHandler
and store the response in a MemoryStream
.
Any assistance with this would be appreciated.
Thanks.