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.
精彩评论