You can first download the file from a remote location on your server using WebClient.DownloadFile :
using (var client = new WebClient()) { client.DownloadFile("http://remotedomain.com/somefile.pdf", "somefile.pdf"); Response.WriteFile("somefile.pdf"); }
or if you do not want to save the temporary file to disk, you can use the DownloadData method and then stream the buffer in response.
UPDATE:
Example with the second method:
using (var client = new WebClient()) { var buffer = client.DownloadData("http://remotedomain.com/somefile.pdf"); Response.ContentType = "application/pdf"; Response.AppendHeader("Content-Disposition", "attachment;filename=somefile.pdf"); Response.Clear(); Response.OutputStream.Write(buffer, 0, buffer.Length); Response.Flush(); }
source share