Push Stream to Browser via Web Service

Jul 15, 2011 at 7:35 PM

I am currently using a web service to create the output file (.xlsx) and it is automatically opening in Excel.  Only problem I have with this is the cleanup.  I don't want to leave a ton of temporary files out on my web server.  So, I want to use a stream to push the file to the browser (Save-As).  I have tried multiple methods and cannot get this to work.  Can anyone please help?  

Thanks,
gomer 

Editor
Jul 15, 2011 at 7:58 PM

I dont know if I understand you well...but you can stream your package using GetAsByteArray method.

Response.Clear();
Response.AddHeader("content-disposition", "attachment; filename=file.xlsx");
Response.AddHeader("Content-Length", output.Length.ToString();
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(pck.GetAsByteArray());
Response.End();

Jul 15, 2011 at 8:34 PM

I have attempted to use that code and it does nothing.  It's like the Response object in Context doesn't communicate with the browser.  I'm using a Web Service for this.  There's something that I'm missing to be able to cause this Response to be pushed to the browser.