Kevin:
I think that the problem is that you are writing all the data at once in the
response stream and while the user is taking their time to click on the
"Save As" button, browser is downloading the data in the background.
Remember that IE downloads the files to a temp location and then moves it if
the user chooses to save it to a different location. With or without "Save
As" browser will always download the file to the local cache.
May be you can download the file from the remote server (say 192.168.16.133)
into a temp file on your local server and then redirect the response to this
temp file. This is better for performance anyway because then you are
letting the web server do what it does best -- i.e., serve static files.
Cheers,
Shariq Khan
<kennedyk78@hotmail.com> wrote in message
news:1102604988.830436.93060@z14g2000cwz.googlegro ups.com...[color=blue]
>
> Hi Nicholas,
>
> Cheers, but I already have the content disposition header in. In this
> case I just made called the file mySummerHoliday.wmv.
>
> WebClient wc = new WebClient();
> byte[] byteData;
> Response.ContentType="application/octet-stream";
> Response.AddHeader(
> "contentdisposition",
> "attachment;filename=mySummerHoliday.wmv");
> Response.BinaryWrite(byteData
> = wc.DownloadData(@"http://192.168.16.133/media/mySummerHoliday.wmv"));
>
> What I'm trying to achieve is that it streams in the 'Save As' dialogue
> but with my current code it get's downloaded to the page before the
> 'Save As' dialogue.
>
> Then the 'Save As' dialogue appears and it says it's saved a 4MB file
> in 1 second.
>
> I only want the content to be downloaded once you click 'Save' as in
> all web based downloads.
>
> I know this should be pretty simple I just can't work it out!
>
> Regards,
> Kevin
>
>
> Nicholas Paldino [.NET/C# MVP] wrote:[color=green]
>> Kevin,
>>
>> You might want to try adding the content disposition header to[/color]
> the[color=green]
>> response stream, like so:
>>
>> // Add the content disposition header to the response.
>> Response.AddHeader("content-disposition", "attachment; filename=" +
>> pstrFileName);
>>
>> Where pstrFileName is the name of the file you want to recommend[/color]
> to save[color=green]
>> as.
>>
>> Hope this helps.
>>
>>
>> --
>> - Nicholas Paldino [.NET/C# MVP]
>> -
mvp@spam.guard.caspershouse.com
>>
>>
>>
>> <kennedyk78@hotmail.com> wrote in message
>> news:1102597350.178561.162940@z14g2000cwz.googlegr oups.com...[color=darkred]
>> > I'm afriad changing the ContentType to "application/octet-stream"
>> > results in the same behaviour where the media is downloaded before[/color][/color]
> the[color=green][color=darkred]
>> > 'Save As' dialogue opens.
>> >
>> > WebClient wc = new WebClient();
>> > byte[] byteData;
>> > Response.BinaryWrite(byteData
>> >[/color][/color]
> =wc.DownloadData(@"http://192.168.16.133/media/mySummerHoliday.wmv"));[color=green][color=darkred]
>> > Response.ContentType="application/octet-stream";
>> > Response.AddHeader(
>> > "content-disposition","attachment;filename=mySummerHoliday. wmv");
>> >
>> > I think I need to read the data into FileStream, but that only[/color][/color]
> seams to[color=green][color=darkred]
>> > take physical paths and not URIs.
>> >
>> > Regards,
>> > Kevin
>> >[/color][/color]
>[/color]