0

I have download button which after download i want to redirect to another page.

Response.ContentType = "application/pdf";
                 Response.AddHeader("Content-Disposition", "attachment; filename=downloadfile.pdf");
                 Response.TransmitFile(Server.MapPath("downloadfile.pdf"));
                 Response.AddHeader("Refresh", "3;URL=redirectpage");

This is the code for downloading the file, right now after downloading the file is not redirecting to the page i want to redirect.

Filburt
  • 17,626
  • 12
  • 64
  • 115
Darko
  • 1

1 Answers1

1

Depending on how the request for the file is made, you may want to consider using some client-side code to perform the redirection. A small example of a file download requested from a hyperlink can can be found here:

https://social.msdn.microsoft.com/Forums/sharepoint/en-US/58ff5ed5-c3af-40f9-b136-b0415a0c767c/redirect-after-file-download?forum=sharepointdevelopmentprevious

This example redirects after starting the file download.

You could also redirect then initiate the download as show here (context is with PHP but solution is HTML-based and JS-based)

PHP generate file for download then redirect

Matthew D
  • 196
  • 6