0

I struggle quite a complicated scenario to which I cannot find the answer.

I am trying to create a REST service with ASP.NET WebAPI which serves as a wrapper for file operations on a server. Therefore I am trying build an API like System.IO.File and System.IO.Directory. With System.IO.File comes the method Create which opens a Stream to the newly created file. The stream is writable so that it can be used to write content to the new file.

For my purpose I need to achieve this behaviour for my service as well. So the response should return a writable stream to the client and the this way the client can write data to the server.

I tried using StreamContent but it cannot be used with a stream that is only writable. It says "Reading is not supported on this stream." along with throwing a NotSupportedOperationException.

Is there any way I can pass a writable stream back to my client?

Thanks in advance.

dr_d00m
  • 21
  • 5
  • I am not sure if this is what you looking for, but check [this](https://stackoverflow.com/questions/1072814/c-sharp-asp-net-write-file-to-client) will help ? – Munzer Aug 21 '17 at 14:20
  • Thanks for the answer, but I don't think so. It just produces an OutputStream which cannot be written by the client. – dr_d00m Aug 22 '17 at 06:31

0 Answers0