Wednesday, July 3, 2013

Asp.net / vb.net - how to open a file in asp.net

To open a file in asp.net

Dim filename As String = "D:\\foldername\\testbinary.pdf"
Response.AddHeader("Content-Disposition", "attachment; filename=" & Path.GetFileName(filename))
Response.WriteFile(filename)
Response.Flush()
Response.Close()

No comments:

Post a Comment