https下 ie 无法下载文件
Private Sub DownLoadPDF(ByVal filepath As String)
Dim response As System.Web.HttpResponse = System.Web.HttpContext.Current.Response
Dim pdfFileName As String = "Exported.pdf"
If (File.Exists(filepath)) Then
Dim downloadBytes() As Byte = File.ReadAllBytes(filepath)
pdfFileName = Path.GetFileName(filepath)
'File.Delete(Me.pdfFilePath)
response.Clear()
response.AddHeader("Content-Type", "binary/octet-stream")
'response.AddHeader("Expires", "0")
'response.AddHeader("Pragma", "public")
'response.AddHeader("Pragma", "no-cache")
'response.AddHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0")
'response.AddHeader("Cache-Control", "public")
If (System.Web.HttpContext.Current.Request.Browser.Browser.ToLower() = "ie") Then
pdfFileName = HttpUtility.UrlEncode(pdfFileName, System.Text.Encoding.UTF8)
End If
response.AddHeader("Content-Disposition", ("attachment; filename=" _
+ (pdfFileName + ("; size=" + downloadBytes.Length.ToString))))
response.Flush()
response.BinaryWrite(downloadBytes)
response.Flush()
response.End()
End If
End Sub
网上说加上注释的那段就可以,可我始终没有成功(在pageload事件中掉改方法没有问题,但是在按钮的click事件中就会出现下载aspx页面,并提示找不到)
哪位高手指点下啊 --------------------编程问答-------------------- --------------------编程问答-------------------- 只能靠自己,自己解决了 --------------------编程问答-------------------- --------------------编程问答-------------------- 请问一下你是怎么解决的呢
补充:.NET技术 , ASP.NET