Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Allow file import
Message
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Allow file import
Miscellaneous
Thread ID:
01098214
Message ID:
01098214
Views:
58
I have the following code to allow the pdf document download from the aspx page. After the file download file can not be open with the following message:


"There was an error openning this document. The file is damaged and could not be repaired"
Dim strPhysicalPath
        Dim objFileInfo As System.IO.FileInfo
        Dim strFileName As String = "C:\Inetpub\wwwroot\DSIMktng\EventDownloads\" + "ddimer.pdf"
        strPhysicalPath = Server.MapPath("ddimer.pdf")


        objFileInfo = New System.IO.FileInfo(strPhysicalPath)
        Response.Clear()
        'Add Headers to enable dialog display
        'Response.ContentType = "application/octet-stream"
        Response.ContentType = "application/pdf"
        Response.AddHeader("Content-Disposition", "attachment; filename=" & _
           objFileInfo.Name)
        'Response.AddHeader("Content-Length", objFileInfo.Length.ToString())
        Response.WriteFile(objFileInfo.FullName)
TIA,
Daniel
Reply
Map
View

Click here to load this message in the networking platform