locked
IDataServiceStreamProvider content file name RRS feed

  • Question

  • How can I add the file name to the response stream that is returned using GetReadStream? When get the $value it returns a strem but the browser saves it with a .part extension. Can we mention the file name in the response headers somewhere?

    Thanks.


    Rosy Madhuri
    Friday, October 7, 2011 7:57 PM

Answers

  • Hi,

    In the GetReadStream method set the "Content-Disposition" header on the outgoing response to specify the filename when the stream is downloaded.

    http://www.jtricks.com/bits/content_disposition.html

    Use System.ServiceMode.Web.WebOperationContext.OutGoingResponse.Headers["Content-Disposition"] =String.Format(" attachment;filename ={0}", "FileName.txt" );

    Phani
    Phani Raj Astoria http://blogs.msdn.com/PhaniRaj
    Friday, October 14, 2011 3:36 AM
    Moderator