I dont want the windows media player automatically open the wmv files as streaming videos. I want the wmv links to open as download dialog boxes. I know one approach is to zip the wmv files but i dont want this. How can i achieve this?

Recommended Answers

All 6 Replies

Could you try adding the files to the server and then pointing a hyperlink to them to download them or must you have a download box?

if you point a media file in the format of .wmv the windows media player automatically plays them. I dont want that happen, i want the download dialog box to open.

Right I see, I remember once I tried to do this. That was a while back mind, and I didn't find a solution. However, I will do some research, hold on..

i know that it is possible, i searched for sample wmv downloads and i have seen many links that automatically opens as download dialog boxes.

i have found it at the following address : http://www.dotnet247.com/247reference/msgs/30/152516.aspx

string filename = "C:\MyFolder\MyFile.xyz";

System.IO.FileInfo file = new System.IO.FileInfo(fileName);

Response.Clear(); // clear the current output content from the buffer

Response.AppendHeader("Content-Disposition", "attachment; filename=" + file.Name);

Response.AppendHeader("Content-Length", file.Length.ToString());

Response.ContentType = "application/octet-stream";

Response.WriteFile(file.FullName);

Response.End();

Great, Im glad you found it - thanks for sharing!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.