0

I’m using a web API and this includes a method to get a file from within the system. Here is a code snippet it provides

    System.IO.Stream s = new System.IO.FileStream(
    @"c:\File.txt", System.IO.FileMode.Create);
result = proxy.get_doc_file(fileId, ref s );
s.Close();

Now what I like to do is to convert this stream so that the file is available to download. I believe this is done by using a response object? Basically I’d like the user to get ‘save as’ dialog box.

Any help much appreciated. I’m using C# .net 3.5

andyw27
  • 25
  • 4
  • you can find it right here by searching a bit - [here is an example question/answer](https://stackoverflow.com/questions/9541351/returning-binary-file-from-controller-in-asp-net-web-api) – Random Dev Aug 25 '15 at 18:56
  • It sounds like you're right on track. You simply need to build the middle layer (your code above) which is responsible pulling back the result from the proxy, wrapping it in a http response object, and returning it to the client. Check out -- http://stackoverflow.com/questions/14158804/return-file-download-from-byte – George Johnston Aug 25 '15 at 18:58

0 Answers0