I'm trying to actually display a pdf file on a web page. However, everything I've tried always prompts for a download. Does anyone have any idea how to do this? This is what I have been trying.
Dim MyFileStream = New FileStream(Server.MapPath("test.pdf"), FileMode.Open, FileAccess.Read)
Dim FileSize = MyFileStream.Length
Dim Buffer() As Byte
ReDim Preserve Buffer(CInt(FileSize - 1))
MyFileStream.Read(Buffer, 0, CInt(FileSize - 1))
MyFileStream.Close()
Response.BufferOutput = True
Response.ClearContent()
Response.ClearHeaders()
Response.AddHeader("Content-Length", Buffer.Length.ToString)
Response.AddHeader("content-disposition", "inline;filename=YourReport.pdf")
Response.ContentType = "application/pdf"
Response.BinaryWrite(Buffer)
Response.Flush()
Response.Clear()