Returning a stream directly to the web browser
-
16-09-2019 - |
Question
I am generating a file on the server and I do not want to write it to disk but instead return it to the client via a web service. What recommendations would you have to do this?
Solution
Response.OutputStream.Write(...)
Or if you have a MemoryStream:
MemoryStream ms = ...;
ms.WriteTo(Response.OutputStream);
Edit:
If it's a SOAP web service, then just return a byte array from your web service method in your asmx.cs file
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow