开发者

Rendering memory stream to browser in VB.NET

In VB.NET, how can I write a memory stream to browser. My memory stream object has data to build a PDF file. Now I want it to be ren开发者_开发知识库dered on browser. How to do that?


You could try something like:

Dim stream As MemoryStream = GetMemoryStream()
Response.Clear()
Response.ContentType = "application/pdf"
Response.AddHeader("Content-Disposition", "attachment; filename=yourfile.pdf")
Response.Write(stream.ToArray())
Response.End()

I have not tested the code nor am I sure of the mime type, but this should get you started.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜