Téléchargement de plusieurs fichier(PDF)
Bonjour
je cherche à générer et télécharger x fichier PDF (factures par lots), pour la première pas de soucis mais à la fin de chaque création je termine par
Code:
1 2 3 4 5 6
|
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment;filename=" & "DDA Facture " & fac.Fac_Num & " " & Client.User_Nom & " " & Client.User_prenom & ".pdf")
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.BinaryWrite(stream.ToArray)
Response.End() |
j'ai aussi essayé
Code:
1 2 3 4
|
HttpContext.Current.Response.Flush() 'Sends all currently buffered output to the client.
HttpContext.Current.Response.SuppressContent = False 'Gets or sets a value indicating whether to send HTTP content to the client.
HttpContext.Current.ApplicationInstance.CompleteRequest() 'Causes ASP.NET to bypass all events and filtering in the HTTP pipeline chain of execution and directly execute the EndRequest event. |
mon problème est que dans le premier cas Response.End() provoque une Exception et donc arrête le code
et dans le deuxième cas j'ai une Exception "Le serveur ne peut pas ajouter l'en-tête après l'envoi des en-têtes HTTP"
Merci de votre aide