Note that there are some explanatory texts on larger screens.

plurals
  1. POPlaying Windows Media Video Served By .ashx
    text
    copied!<p>I have embedded a windows media player in a web page, using the usual <code>&lt;object&gt;</code> and <code>&lt;embed&gt;</code> tags. The video is served by an ashx (http handler). When I try to play the video, I usually (but not always) get an error message telling me that the file extension (ashx) does not match the file format.</p> <p>This happens in IE (9 &amp; 10) and also in Firefox (latest) with the WMP plugin.</p> <p>I know that the tags (with classid, etc) are correct because the media player displays and allows me to click the 'play' button.</p> <p>The ashx returns the correct mime type (video/x-ms-wmv) and a valid file name (somevideo.wmv) in the response headers. I have tried content-disposition attachment and inline.</p> <p>I have tried urls using 'http://', 'https://', and '//' (which I prefer)</p> <p>If I put the url (including the .ashx) of the video file in the browser address bar directly, the video downloads and plays.</p> <p>If I modify the object tag to use a direct path to the video file (/somewhere/somevideo.wmv), it works - but I can't use this as a solution.</p> <p>The same ashx serves up video and audio in various other formats with out any fuss - it just seems that the embedded windows media player doesn't like it.</p> <p>This has been working for several years - I think this is some new behavior, though I can't identify what has changed, other than browser updates.</p> <p>EDIT: a more careful study in Fiddler showed something I missed before. If I access the video directly (by entering my ashx url in the browser address bar), the video plays in the standalone media player. The content type and disposition headers are correct.</p> <p>However, when using the embedded player, I usually (not always) get OPTIONS and PROPFIND requests from user agent "Microsoft-WebDAV-MiniRedir/6.1.7601". I do not have WebDAV enabled, and I do not respond to options and propfind requests. The embedded player does not request the actual video file.</p> <p>Correction - I do actually respond to the options request - here is the request and response info from fiddler :</p> <pre><code>OPTIONS http://mydomain.com/myhandler.ashx HTTP/1.1 User-Agent: Microsoft-WebDAV-MiniRedir/6.1.7601 translate: f Connection: Keep-Alive Host: mydomain.com HTTP/1.1 200 OK Allow: OPTIONS, TRACE, GET, HEAD, POST Server: Microsoft-IIS/7.5 Public: OPTIONS, TRACE, GET, HEAD, POST X-Powered-By: ASP.NET Date: Tue, 24 Dec 2013 16:03:49 GMT Content-Length: 0 </code></pre> <p>This is followed by four identical requests, using PROPFIND instead of OPTIONS. the response is 404.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload