Microsoft attempts to make the Windows Media experience painless for users by automatically handling certain interactions with video files. For instance, if you click on a Web link connected to a WMV or WMA file in a Web browser, Windows Media Player automatically launches, starts buffering the file, and attempts to stream it. As a server administrator, this feature can create a frustrating experience for users.
PMC Movies, my site with videos for portable movies, offers a number of 300-500MB meant for people to download and take with them. When someone finds a movie they want to download, the natural reaction is to click the download link and expect the Save As dialog box. If the movies are stored on a Windows 2003 Server, with the default IIS configuration, the user never sees the Save As dialog. Instead, Windows Media Player opens on the user’s desktop and begins playing the file. The hack from the user perspective is to right-click and save target as, which potentially confuses and frustrates users.
Microsoft provides a way to override this “stream now” behavior at the server side using a custom HTTP Header in IIS. To add the custom header, launch Internet Information Services Manager and expand your Web sites to reveal the folder where multimedia content is stored. Right-click this folder and choose Properties. Click the HTTP Headers tab, followed by the Add button.
For the Custom header name type: Content-disposition
For the Custom header value type: attachment
Click OK, click Apply, click OK.
Visit one of the Web pages linking to your content download and test the links. You should be presented with the Save As dialog.
There is a catch to this solution. By setting the Content-disposition for the entire folder, your server will pop the Save As dialog box for any file called by a Web browser, including Web pages. There are two ways to solve this problem: only store media files in the folder where you modify the Content-disposition or set the attribute on-the-fly using code.