We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Using Document.Save() in WCF

The SAVE method of the DOCUMENT object allows you to reference the current instance of the the HttpContext.Current.Response object when streaming the document back to the caller.

How do you handle this in WCF, where HttpContext.Current.Response is not available to you?

Hi Peter,

Thanks for your request. In WCF application you should use Aspose.Words .NET 3.5 Client Profile. This version of Aspose.Words.dll does not have the overload of Save method that accepts HttpContext.Current.Response as a parameter.

Best regards,

Hi Alex

Thanks for the fast response.

In Aspose.Words .NET 3.5, how do you stream a document back to the requestor using WCF?


Thanks for your request. You can save the document into a Stream and sent this stream back to the requestor.

Here you can find an answer, how to send a stream to the requestor:


Best regards,

Hi Alex

Is there an example of this logic implemented to support saving a document via Aspose.Words?

Thanks for your help!


Thanks for your request. No, there is no complete example that uses Aspose.Words. However, it should be easy to implement. Using Aspose.Words, you get a stream that contains a document. Then you need just sent this stream to the client.

Here is a simple code that shows how to save the document to stream:

MemoryStream docStream = new MemoryStream();
doc.Save(docStream, SaveFormat.Doc);

Best regards,