Oh dear paypal,
I'd like to know why the "return redirect Url" page won't load if I call Response.AppendHeader
. You see, I'm trying to make a file download automatically after the user has payed on paypal's page so I put the following code on my Page_Load
If Not IsNothing(Request.QueryString("paymentId")) Then
Dim paypalUtils As New PayPalUtils
paypalUtils.ProcessPayPalResponse(Request.QueryString("paymentId").ToString(), Request.QueryString("PayerID").ToString())
TransmitFile()
End If
My TransmitFile
implementation is very simple
Protected Sub TransmitFile()
Response.ContentType = "application/sla"
Response.AppendHeader("Content-Disposition", "attachment; filename=" & Path.GetFileNameWithoutExtension(hidFileName.Value) & ".stl")
Response.TransmitFile(Sistema.SavePath & Path.GetFileNameWithoutExtension(hidFileName.Value) & ".stl")
Response.End()
End Sub
The problem is that somehow calling Response.AppendHeader
or any of the following lines prevents paypal from correctly redirecting to the proper url that I specified on the API.
If I comment the TransmitFile
on Page_Load everything works as expected (Paypal redirects me to my site). If not, I sucessfully make the file download automatically but I get stuck on this page
What is that I'm doing wrong?