MemoryStream as input to file download?
Posted on 2006-11-30
I tried using a memorystream as input to an xml file download, so I wouldn't have to create a disk file (to then delete)....
Response.AddHeader("Content-Disposition", "attachment; filename=" & varFileName)
Response.ContentType = "text/XML"
' Response.WriteFile(varFilePath & varFileName) < the alt way to do it
''--- use memorystream
varMemTab.Position = 0
Dim wrkStreamReader As New StreamReader(varMemTab, Encoding.UTF8)
Dim content As String = wrkStreamReader.ReadToEnd()
''---- do the write
....but it gave an http exception error like it was processing the markup in the Response.WriteFile(content) statement.
Might there be a way to make this work?
Any suggestions would be appreciated.