I have a folder named Test. I have some .xls files and .txt , .doc files in it.爲什麼我的<a href="test.xls"> is working and .txt is not?
In the html I have
<p> <a href="../../Test/Stats.xls">Download excel file </a> </p>
- when I click on this link it is opening a download window (Working fine)
<p> <a href="../../Test/Stats.txt">Download Text file </a> </p>
<p> <a href="../../Test/Stats.doc">Download excel file </a> </p>
But these 2 are not working. Instead of opening a download window they are going to that .doc file link and saying that the page cannot be found.
why the download window is coming for .xls and not for .do or .doc? How can I fix this??
找不到頁面?文件夾中的文件名Stats.doc和Stats.txt真的存在嗎? – 2012-01-18 16:12:59
您可能需要調整您的服務器的MIME類型。 – 2012-01-18 16:14:26
瀏覽器對於文本文件(.txt)的默認行爲是打開頁面,就像它是一個網頁並且不提示下載。這並不能解釋爲什麼會出現404錯誤。如果您使用的是IIS 7,則可能沒有.DOC/.DOCX和.TXT的MIME類型作爲允許的擴展名。可能存在阻止IIS_USER帳戶訪問權限的問題。您是否使用過像Fiddler這樣的工具來觀看對IIS的請求並查看HTTP狀態碼?你有沒有檢查你的IIS日誌? – 2012-01-18 16:15:50