FireFox Streams the ASX file instead of offering a file download dialog box like IE

I am wanting to offer users of my application the ability to download asx files, edit and play them in a Windows Media Player HTML object. The JavaScript works as expected in IE. The application determines the browser type to decide the correct declaration of the WMP object and everything works fine in IE / Firefox... except the problem I face is that FireFox plays the file... and then you have to click File... Save Page As... to save the .ASX file instead of just offering a simple download prompt. Is their any parameters I can pass in to open a new window as a file download instead of playable content? Do I need to create a seperate ASP.NET page called Download.aspx?... that offers asx, and other media files up as content... Any good examples of this?
onclick="javascript:window.open('http://localhost:4978/MediaCenter/media/SamplePlaylist.asx');"

Open in new window

LVL 1
ryanmauldinAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MrAgileCommented:
Hi,

If I understand it right, you want to download a file (not open it) when you click a button. Check this out:

sean

 
 
string URL = @"
FileInfo" target=_blank>http://.../myFileToDownload.txt";
FileInfo fileInfo = new FileInfo(URL);
 
if (fileInfo.Exists)
{
 Response.Clear();
 Response.AddHeader("Content-Disposition", "attachment; filename=" + fileInfo.Name);
 Response.AddHeader("Content-Length", fileInfo.Length.ToString());
 Response.ContentType = "application/octet-stream";
 Response.Flush();
 Response.WriteFile(fileInfo.FullName);
}

Open in new window

0
MrAgileCommented:
Oops!
string URL = "your_url";
FileInfo fileInfo = new FileInfo(URL);
 
if (fileInfo.Exists)
{
 Response.Clear();
 Response.AddHeader("Content-Disposition", "attachment; filename=" + fileInfo.Name);
 Response.AddHeader("Content-Length", fileInfo.Length.ToString());
 Response.ContentType = "application/octet-stream";
 Response.Flush();
 Response.WriteFile(fileInfo.FullName);
}
--

Open in new window

0
Michel PlungjanIT ExpertCommented:
and then no need to use window.open

<a href="http://localhost:4978/sendPlayList.aspx?file=MediaCenter/media/SamplePlaylist.asx');">Download file</a>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ryanmauldinAuthor Commented:
that sounds right I will try it out.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Browsers

From novice to tech pro — start learning today.