ASP.NET文件下载,在线播放视频的问题

Shalves Shalves 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
苹果手机用浏览器打开这个地址
http://218.21.212.10/vod/play/mine.mp4 不能播放(显示一个禁止播放的图标),求解!
此地址是asp.net在代码中处理请求自写的HTTP响应,地址经过UrlRouting,目前快播,百度影音,小米、三星手机都能在线播放。

http://218.21.212.10/videos/mine.mp4是实际物理文件地址,苹果手机直接打开此地址可以播放,已测,无悬念,但是

http响应头

HTTP/1.1 200 OK
Date: Mon, 25 Feb 2013 10:23:13 GMT
Server: Microsoft-IIS/6.0
Content-Length: 1826940
Content-Location: http://218.21.212.10/vod/play/mine.mp4
Accept-Ranges: bytes
Cache-Control: public
Last-Modified: Mon, 28 Jan 2013 08:14:10 GMT
ETag: "758d7012a2b27f73e1752e512d165e89"
Content-Type: application/octet-stream

http响应头除了Cache-Control: public一句去不掉之外,其它的跟直接访问物理地址几乎一模一样

安装了快播的朋友 输入地址http://218.21.212.10/ 可以直接用快播看。

输出HTTP头部分的代码

Response.StatusCode = 200;

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

//ContentType
Response.ContentType = GetContentType(fi.Extension);

//ContentLocation
Response.AppendHeader("Content-Location", Request.Url.AbsoluteUri);

//Last-Mondified
Response.Cache.SetLastModified(fi.LastWriteTime);

Response.AppendHeader("Accept-Ranges", "bytes");

//Cache-Control
Response.Cache.SetCacheability(HttpCacheability.Public);

//ETag
Response.Cache.SetETag(fileHash);

Response.TransmitFile(FilePath);
Response.End();
...全文
评论 7
收藏 已收藏
分享
返回顶部
Shalves
.NET社区 62,272 成员 668,968 内容