无法以限制访问方式内联视频文件?

时间:2014-01-07 19:13:52

标签: video inline content-disposition

我正在制定一项要求,允许通过我的应用程序主页中的链接从共享点位置播放.mp4文件。此应用程序基于表单身份验证模式,我使用.ashx处理程序通过将视频从共享点位置获取到字节数组并写入响应来流式传输视频,如下所示。

byte[] response = getfromsharepoint(filepath);
context.Response.BinaryWrite(response);
context.Response.AppendHeader("content-disposition", "inline; filename=" + fileName);
context.Response.AddHeader("content-legth", response.Length.ToString());
context.Response.AddHeader("cache-control", "no-store");
context.Response.End();

但是,当我尝试它时,我在Windows Media Player中收到此错误:“Windows Media Player无法播放该文件。播放器可能不支持该文件类型,或者可能不支持用于压缩文件的编解码器。”但是,当我使用“附件”内容 - 处置时,它可以正常工作。

当我在网上搜索此内容时,发现了一条建议删除web.config文件中处理程序限制的帖子,如下所示,它也以内联模式工作,不幸的是,我需要在限制中运行它访问以便匿名用户无法通过获取网址来播放视频。

<location path="VideoHandler.ashx"> 
<system.web>
<authorization> 
<allow users="*"/>
</authorization> 
</system.web>

</location>

有人可以建议一种方法来实现这一目标吗?非常感谢任何帮助。

谢谢!

0 个答案:

没有答案