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