我有這樣的.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