1

我有一个应用程序,我需要将视频上传为:

html

<iframe id="frame1" runat="server" visible="false"
       style="height: 222px; width: 482px;"></iframe>

代码

Finalpath = filepath + filename;
frame1.Visible = true;
frame1.Attributes.Add("src", Finalpath);

但是当我加载视频扩展Mp4时,它会显示错误Iframe

HTTP Error 404.3 - Not Found

由于扩展配置,无法提供您请求的页面。如果页面是脚本,则添加处理程序。如果应该下载文件,请添加 MIME 映射。

如何处理此服务器错误以及我可以上传什么类型(扩展名)的视频?感谢您的帮助..

4

1 回答 1

14

您应该在 IIS 或 web.config 文件中为 .MP4 格式添加 MIME 类型 在 Web.Config 对于 IIS 7,您可以在配置中添加此部分。

<system.webServer>
    <staticContent>
        <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
    </staticContent>
</system.webServer>

您可以使用 HTML 5<video>标签来显示您的 .mp4 视频

<video width="320" height="240" controls="controls">
  <source src="movie.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video> 
于 2012-09-28T06:07:47.413 回答