开发者

Why does Windows Media Player sometimes fail to include the appropriate cookies in requests for content when it is being used via Internet Explorer?

开发者 https://www.devze.com 2023-01-11 21:05 出处:网络
We have a site hosted in IIS6 that we built using the .NET 1.1 Framework. Users who go to this site use Internet Explorer exclusively and log into it using Forms authentication. Within the site, users

We have a site hosted in IIS6 that we built using the .NET 1.1 Framework. Users who go to this site use Internet Explorer exclusively and log into it using Forms authentication. Within the site, users can navigate to a specific page that has an iFrame embedded in it. This iFrame points to another virtual directory hosted on the same server, and this second virtual directory simply streams down the movie file. Assuming the user has Windows Media Player installed on their machine and has configured it so that Windows Media Player is the default movie player, when a user navigates to the page with the iFrame, Windows Media Player pops open a new window and the movie plays.

We very recently upgraded our software to use the .NET 3.5 framework. However, we have noticed that our movie file no longer plays. We instead get a message indicating that Windows Media Player cannot connect to the server.

I've gone ahead and done some investigation of the network traffic between the client and server machines by using Fiddler, and these are the steps that happen in the scenario where things work:

1) Internet Explorer makes a request to the server for the movie file. The request header contains cookies that are required for proper authentication and session identification.

*GET MYSITE HTTP/1.1

Accept: image/jpeg, image/gif, image/pjpeg, application/x开发者_JAVA技巧-ms-application, application/xaml+xml, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, /

Referer: MYREFERRER

Accept-Language: en-US

User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; InfoPath.2)

Accept-Encoding: gzip, deflate

Host: MYHOST Connection: Keep-Alive

Cookie: a99fd71e-eb1b-4750-a391-5ad8cfe32068=800edb77-9649-4f93-9db9-98d678a3b166; ASP.NET_SessionId=uf1cr1bflwly0nmhbm1wnb55; EDDS=581A46E81C8DB0B475F1AFE00545F9B157A377BD31DF65BB2AEF7D1B293BDE9E178409FF251CF49F109FDC601C48F15A5FCDE1A29A18E6853357887698A01E7A2CC3690ECE98C464DE1359D796B60BE969F875EF08F638A04CDED78A309ACD6E9732F8C3751A2B0A411ADFA91B0AE567*

2) The server uses the cookies to authenticate the request from the user and then returns the movie. The status code of the return is a 200.

HTTP/1.1 200 OK

Date: Wed, 11 Aug 2010 21:30:55 GMT

Server: Microsoft-IIS/6.0

X-Powered-By: ASP.NET

X-AspNet-Version: 1.1.4322

Content-Length: 3934146

Accept-Ranges: bytes

Content-Disposition: inline; filename = AS000006.wmv

Last-Modified: Tue, 10 Aug 2010 21:24:49 GMT

ETag: "MyExampleFileID"

Cache-Control: private

Content-Type: application/octet-stream

3) Windows Media Player makes a request to the server for the movie file. Again, the request header contains cookies. However, this time the request includes a Range request for bytes 8192-.

*GET MYSITE HTTP/1.1

Accept: /

User-Agent: Windows-Media-Player/12.0.7600.16415

Accept-Encoding: gzip, deflate

Range: bytes=8192-

Unless-Modified-Since: Tue, 10 Aug 2010 21:24:49 GMT

If-Range: "MyExampleFileID"

Connection: Keep-Alive

Host: MYHOST

Cookie: ASP.NET_SessionId=uf1cr1bflwly0nmhbm1wnb55; EDDS=581A46E81C8DB0B475F1AFE00545F9B157A377BD31DF65BB2AEF7D1B293BDE9E178409FF251CF49F109FDC601C48F15A5FCDE1A29A18E6853357887698A01E7A2CC3690ECE98C464DE1359D796B60BE969F875EF08F638A04CDED78A309ACD6E9732F8C3751A2B0A411ADFA91B0AE567; a99fd71e-eb1b-4750-a391-5ad8cfe32068=800edb77-9649-4f93-9db9-98d678a3b166*

4) The server uses the cookie information to authenticate the request from the user and then returns the document. The status code of the return is a 206.

HTTP/1.1 206 Partial Content

Date: Wed, 11 Aug 2010 21:30:57 GMT

Server: Microsoft-IIS/6.0

X-Powered-By: ASP.NET

X-AspNet-Version: 1.1.4322

Content-Range: bytes 8192-3934145/3934146

Content-Length: 3925954

Accept-Ranges: bytes

Content-Disposition: inline; filename = AS000006.wmv

Last-Modified: Tue, 10 Aug 2010 21:24:49 GMT

ETag: "MyExampleFileID"

Cache-Control: private

Content-Type: application/octet-stream

When things don't work, it looks like this:

1) Internet Explorer makes a request to the server for the movie file. The request header contains cookies.

*GET MYSITE HTTP/1.1

Accept: image/jpeg, image/gif, image/pjpeg, application/x-ms-application, application/xaml+xml, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, /

Referer:MYREFERRER Accept-Language: en-US

User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; InfoPath.2)

Accept-Encoding: gzip, deflate

Host: MYHOST

Connection: Keep-Alive

Cookie: a99fd71e-eb1b-4750-a391-5ad8cfe32068=7ac4710e-1434-43c9-b521-bdf30328e2fb; ASP.NET_SessionId=glytwo55ztohig451qrf1355; EDDS=CFC5EAE69F6D6CDD0A1D53632F01629F8AC8F4901A6106DD26A0A9F4E1E0B0EC9D4B1B78FBEF5C504A54E6B1A43F576CD846ADD3D394DF257EBBF982BED5E99900116945191268E985ED923DAA78DF4FBD68B09FF3B4D14D7092FB846012E5F464D9EBC4BA834235839A397A4F00B548D353A1AB9B67F6F960E26FC655D19D4B89347DFA2BCC7101E2397AC7EB0F105025E5A21253C0E619E809C1D9B64E53E8*

2) The server uses the cookies to authenticate the request from the user and then returns the movie. The status code of the return is a 200.

HTTP/1.1 200 OK

Cache-Control: private

Content-Length: 3934146

Content-Type: application/octet-stream

Last-Modified: Wed, 11 Aug 2010 15:29:44 GMT

Accept-Ranges: bytes

ETag: "MyExampleFileID"

Server: Microsoft-IIS/7.5

X-AspNet-Version: 2.0.50727

Content-Disposition: inline; filename = AS000006.wmv

X-Powered-By: ASP.NET

Date: Wed, 11 Aug 2010 21:36:45 GMT

3) Windows Media Player makes a request to the server for the movie file. The request does NOT contain any cookies. The server fails to authenticate the user and the movie doesn't get sent down.

*GET MYSITE HTTP/1.1

Accept: /

User-Agent: Windows-Media-Player/12.0.7600.16415

Accept-Encoding: gzip, deflate

Range: bytes=8192-

Unless-Modified-Since: Wed, 11 Aug 2010 15:29:44 GMT

If-Range: "MyExampleFileID"

Connection: Keep-Alive

Host: MYHOST*

So, at this point I know exactly why it isn't working. The request from Windows Media Player doesn't contain any cookies, so our server won't authenticate the request and send down the data. What I'm completely failing to understand is why those cookies aren't being used by Windows Media Player when it makes it's request.

All of the above requests were made from the same machine to two different sites, so I know that it isn't an issue with different versions Windows Media Player. I've reproduced the behavior on several different machines with different operating systems and different versions of IE, so it doesn't appear to be related to a specific machine. I've tried reverting back to IIS6 instead of using IIS7 for the new site, and that doesn't make a difference either. I'm left thinking it has to be something in my code, but I don't even know where to begin looking.

My question is: Does anyone really understand how Internet Explorer passes URL information to Windows Media Player and perhaps point me in the right direction to figure this out? My only other option at this point is to open up a ticket with Microsoft support... and to be frank, my experience with their support team has been less than optimal over the past few years. Any help would be GREATLY appreciated!

EDIT: Using process explorer, I've been able to prove that IE is simply not providing cookie information to Windows Media Player now. I'm still no closer to understanding why, though.


After days of troubleshooting with 4 support engineers from Microsoft, we were had been no closer to understanding the issue. Then, one of the guys on my team stumbled across this link:

http://mvolo.com/iis-70-forms-authentication-and-embedded-media-players/

While the error message mentioned in the article isn't the one we're seeing, the solution he proposed resonated with me. We gave it a shot, and thankfully, it solved the issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消