Writing MemoryStream to Response Object

后端 未结 8 1531
闹比i
闹比i 2020-11-27 20:03

I am using the following code to stream pptx which is in a MemoryStream object but when I open it I get Repair message in PowerPoint, what is the correct way of writing Memo

8条回答
  •  天涯浪人
    2020-11-27 20:25

    I tried all variants of end, close, flush, and System.Web.HttpContext.Current.ApplicationInstance.CompleteRequest() and none of them worked.

    Then I added the content length to the header: Response.AddHeader("Content-Length", asset.File_Size.ToString());

    In this example asset is a class that has a Int32 called File_Size

    This worked for me and nothing else did.

提交回复
热议问题