Calling Presentation constructor with Stream from HttpWebResponse results in an Exception


I am trying to call the Presentation Constructor using the Stream overload:
Presentation presentation = new Presentation(masterStream);

The Stream is constructed as the result of an HttpWebRequest/HttpWebResponse pair call:

HttpWebRequest presentationRequest = (HttpWebRequest)WebRequest.Create(providerPath + PresentationFileName);

presentationRequest.Credentials = System.Net.CredentialCache.DefaultCredentials;

HttpWebResponse presentationResponse = (HttpWebResponse)presentationRequest.GetResponse();

When the constructor is called with the stream, a System.IO.IOException is raised.
An unhandled exception of type 'System.IO.IOException' occurred in aspose.powerpoint.dll

Additional information: Unable to read entire block; 240 bytes read; expected 512 bytes


Dear Stef,

Probably it’s not because of stream.
Did you try to open this presentation from local file?



I’ve been doing some further troubleshooting and it appears that the data in the Stream is being corrupted somehow during the download before it is handed to the Presentation constructor.


Stef Shoffren