我有这样的.aspx C#代码有问题的服务,从MP3播放到的.aspx ie浏览器文件:麻烦使用< audio>
protected void Page_Load(object sender, EventArgs e)
{
string url = Request["url"];
string type = Request["ext"];
if (!string.IsNullOrEmpty(url))
{
url = HttpUtility.UrlDecode(url);
WebClient client = new WebClient();
byte[] file = client.DownloadData(url);
if (file != null && file.Length > 0)
{
Response.Clear();
Response.Buffer = true;
Response.ContentType = "audio/mpeg";
Response.AddHeader("Content-Disposition", "inline");
Response.BinaryWrite(file);
Response.End();
}
}
}
它工作正常,在IE之外的所有浏览器。在IE中,<音频>标签播放器显示一条含有“无效源”的神秘消息。没有控制台错误或警告。我猜我在Response设置中有一个微妙的错误。下面是音频>标记<,但正如我所说,它适用于除IE以外的所有浏览器。我已经走出了一条路,试图让它在IE上运行 - 再一次,这是迄今为止最困难的浏览器。经过这么多年,这已经超出了令人心碎的地步。人们在微软做什么?
<audio controls="true" preload="none">
<source src="http://localhost:8056/web/Recordings/RE4cdf6a142506328787e9c88cbf7c4885.mp3" type="audio/mpeg"></source>
Your browser does not support HTML5 audio. Please consider upgrading your browser to the latest version.
</audio>
检查这里的答案,看看这是否会帮助http://stackoverflow.com/questions/27817266/how-to-correctly-use-urlencode-and-decode否则做'谷歌搜索HttpUtility.UrlDecode'来看看你是否正在做错事 – MethodMan
谢谢,但如果解码/编码不好,是不是会影响所有的浏览器,不只是IE?我想这个错误就像我提到的那样是一个响应设置。喜欢,也许我错过了一个标题或错误地使用一个标题? – Ringo
也许你有特殊字符,在IE中有不同的解释 – MethodMan