G
Guest
Im using the following code for downloading attachments in web page, however
I get the error "the file is damaged etc". But when I open directly from the
folder it opens,
***********
Dim myFileInfo As New FileInfo(sender.CommandArgument)
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.End()
**********
Any thoughts are welcome;
I get the error "the file is damaged etc". But when I open directly from the
folder it opens,
***********
Dim myFileInfo As New FileInfo(sender.CommandArgument)
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.End()
**********
Any thoughts are welcome;