G
Guest
Hi,
When i download PDF document from asp.net page, it downloads but does not
open. Message shown is "file is damaged". The file opens when opened directly
from the folder.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim myFileInfo As New FileInfo(Session("dnload").ToString)
Dim myFilePath As String =
System.Configuration.ConfigurationManager.AppSettings("UploadFolder").ToString & "\" & myFileInfo.Name
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ClearHeaders()
HttpContext.Current.Response.ClearContent()
Response.ContentType = "application/pdf"
HttpContext.Current.Response.AppendHeader("content-disposition",
"attachment;filename=" & myFileInfo.Name)
Response.WriteFile(myFilePath)
Response.Flush()
Response.End()
End Sub
What could be reason?
any thoughts are welcome.
When i download PDF document from asp.net page, it downloads but does not
open. Message shown is "file is damaged". The file opens when opened directly
from the folder.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim myFileInfo As New FileInfo(Session("dnload").ToString)
Dim myFilePath As String =
System.Configuration.ConfigurationManager.AppSettings("UploadFolder").ToString & "\" & myFileInfo.Name
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ClearHeaders()
HttpContext.Current.Response.ClearContent()
Response.ContentType = "application/pdf"
HttpContext.Current.Response.AppendHeader("content-disposition",
"attachment;filename=" & myFileInfo.Name)
Response.WriteFile(myFilePath)
Response.Flush()
Response.End()
End Sub
What could be reason?
any thoughts are welcome.