K
kevin
Hi,
Any help with this would be really appreciated!
I'm trying to download a file from a remote server. The access
permissions is okay but the problem I'm facing is that the file is
getting downloaded before the Save As dialogue appears. As we will be
downloading some large files, it's unpractical to have this.
So far the code I have to download the file is
WebClient wc = new WebClient();
byte[] byteData;
Response.BinaryWrite(byteData =
wc.DownloadData(@"http://<remote-server>/media/mySummerHoliday.wmv"));
Response.ContentType="application/wmv";
Response.AddHeader( "content-disposition","attachment;
filename=encryptedindy.wmv");
But as I said this downloads the media before the 'Save As' dialogue.
I also have some code that will save the media from my local drive
FileStream sourceFile = new
FileStream(@"C:\media\mySummerHoliday.wmv", FileMode.Open);
long FileSize;
FileSize = sourceFile.Length;
byte[] getContent = new byte[(int)FileSize];
sourceFile.Read(getContent, 0, (int)sourceFile.Length);
sourceFile.Close();
Response.ContentType="wmv";
Response.AddHeader( "content-disposition","attachment;
filename=mySummerHoliday.wmv");
Response.BinaryWrite(getContent);
But, I've not been able to modify this to download from a remote
server.
I'm sure I'm missing a trick here somewhere. Any ideas?
Regards,
Kevin
Any help with this would be really appreciated!
I'm trying to download a file from a remote server. The access
permissions is okay but the problem I'm facing is that the file is
getting downloaded before the Save As dialogue appears. As we will be
downloading some large files, it's unpractical to have this.
So far the code I have to download the file is
WebClient wc = new WebClient();
byte[] byteData;
Response.BinaryWrite(byteData =
wc.DownloadData(@"http://<remote-server>/media/mySummerHoliday.wmv"));
Response.ContentType="application/wmv";
Response.AddHeader( "content-disposition","attachment;
filename=encryptedindy.wmv");
But as I said this downloads the media before the 'Save As' dialogue.
I also have some code that will save the media from my local drive
FileStream sourceFile = new
FileStream(@"C:\media\mySummerHoliday.wmv", FileMode.Open);
long FileSize;
FileSize = sourceFile.Length;
byte[] getContent = new byte[(int)FileSize];
sourceFile.Read(getContent, 0, (int)sourceFile.Length);
sourceFile.Close();
Response.ContentType="wmv";
Response.AddHeader( "content-disposition","attachment;
filename=mySummerHoliday.wmv");
Response.BinaryWrite(getContent);
But, I've not been able to modify this to download from a remote
server.
I'm sure I'm missing a trick here somewhere. Any ideas?
Regards,
Kevin