here's how my scenario is created.
I click a button which produces a pdf via iTextSharp.
I then click 'Cancel' on the pop-up dialog.
I navigate to another page via hyperlink.
I then click the 'Back' button on IE8
I then click the button which produces the PDF, then I'm redirected to the page I previously viewed (when I clicked the hyperlink). Which is not intended what so ever.
Here's some code that affects the Response object (code is within print_click event)
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment; filename=ManageWorkforce.pdf");
Response.End();
Anyone have a theory why this is happening?
I have always done this with a generic handler like Greg mentioned. This is also nicer if you want to link to the file from other pages in the future, or save it as a favorite, send it to your friend, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With