Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Allow file import
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Allow file import
Divers
Thread ID:
01098214
Message ID:
01098214
Vues:
57
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
Répondre
Fil
Voir

Click here to load this message in the networking platform