Response.AddHeader("Content-Disposition", "attachment;
filename=yourfile.mp3");


Thanks,

Shawn Wildermuth
Wildermuth Consulting Services, LLC
http://adoguy.com
C# MVP, MCSD.NET, Author and Speaker


> -----Original Message-----
> From: Discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Muhammad Adel
> Sent: Friday, November 10, 2006 5:42 PM
> To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> Subject: [ADVANCED-DOTNET] Problem with detecting content type of page
>
> I am trying to start the download of an audio file when the
> user clicks a button using Response.OutputStream. Here is the
> code I am using:
>
>  Response.Clear();
>
>         Response.BufferOutput = true;
>
>         Response.ContentType = "audio/mpeg3";
>
>         Response.OutputStream.Write(audioFile.Data, 0,
> audioFile.Data.Length);
>
>         Response.Flush();
>
> The problem is that the browser doesn't detect the content
> type. On mozilla firefox the browser asks me if I want to
> download mypage.aspx, where mypage.aspx is the page
> containing this code. Actually what the browser downloads is
> the audio file but I have to rename it manually to get it working.
>
> On IE 6 I get  an error saying :
>
> An invalid character was found in text content. Error
> processing resource "mypage.aspx".
>
> What is wrong with my code?
>
>
> ===================================
> This list is hosted by DevelopMentorR  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to