Tuesday 12 August 2014

Open PDF file by Clicking Link Button using ASP.NET

protected sub LInk_click()
Dim pdfPath As String = Server.MapPath("~/AM54640303_2014-05-12_18-51-10.pdf")
        Dim client As New WebClient()
        Dim buffer As [Byte]() = client.DownloadData(pdfPath)
        Response.ContentType = "application/pdf"
        Response.AddHeader("content-length", buffer.Length.ToString())
        Response.BinaryWrite(buffer)

end sub


--"pdf file should be present in solution explorer."

1 comment:

Followers