我有一个将pdf文件写入aspx页面的代码,但问题是当我想保存这个文件时,它会以aspx扩展名保存......例如:
它保存为myPDFfile.aspx,我想将其保存为myPDFfile.pdf
我必须将扩展名更改为 .pdf 才能打开它。
如何以编程方式更改扩展?
我的代码:
Dim pdfPath As String = path + Session("factura").ToString.Trim + ".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)