pretty much...i want to do something like this:
Stream Answer = WebResp.GetResponseStream();
Response.OutputStream = Answer;
Is this possible?
pretty much...i want to do something like this:
Stream Answer = WebResp.GetResponseStream();
Response.OutputStream = Answer;
Is this possible?
No, but you can of course copy the data, either synchronously or asynchronously.
Like so:
using (Stream answer = webResp.GetResponseStream()) {
byte[] buffer = new byte[4096];
for (int read = answer.Read(buffer, 0, buffer.Length); read > 0; read = answer.Read(buffer, 0, buffer.Length)) {
Response.OutputStream.Write(buffer, 0, read);
}
}
This answer has a method CopyStream
to copy data between streams (and also indicates the built-in way to do it in .NET 4).
You could do something like:
using (stream answer = WebResp.GetResponseStream())
{
CopyStream(answer, Response.OutputStream);
Response.Flush();
}