Response.Redirect at a response.end

C

csgraham74

i have the following code

Response.AddHeader("content-disposition", "attachment; filename=" &
str_AccountNo & ".pdf")
Response.ContentType = "application/pdf"
Response.BinaryWrite(oDR.GetValue(0))
Response.End()

this code successfully prints a pdf document for me.

what i want to do is to redirect to another page after this happens.

if i put in a response.redirect after the response.end then the code
stops executing immediately at the response.end and no redirect occurs.
if i put it in before the response.end then the the document does not
print.

are there any other alternatives e.g. javascript to get my redirect to
occurr.

thanks in advance

Cg
 
K

Karl Seguin

Cs:
No. You are telling the browser that you are sending it a PDF file. You
are then sending it the binary information of a pdf file.
Response.Redirect works by sending an Http status code of 302 with the new
url. Http status codes don't mean anything to acrobat. In other words, you
can't have your cake and eat it too. You can't say "I'm sending your a PDF
and here's some HTML to go with it".

The only solution would be to open up the link to this pdf in a new window
and then redirect the original browser wherever.

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top