asp-classic - 经典 ASP 的文件扩展名问题

标签 asp-classic http-status-code-404 file-extension

我正在运行一个经典的 ASP 网站,我的在线用户可以在其中将文件附加到内部消息系统。但是每当他们上传文件扩展名超过 3 个字符的附件时,服务器都会给我一个 404。

mypicture.jpg 这样的文件工作正常,但是像 mydocument.docx 这样的文件不工作?

有什么建议吗?

最佳答案

IIS6 将仅提供文件扩展名映射到服务器或站点的 mime 映射属性中的 mime 类型的文档。为了提供更新的 Office 2007 文档类型,您需要添加额外的映射。

您可以在许多地方找到这些新 MIME 类型的列表。

这是一个简单的;来自 Office 2007 mime types for IIS :

.docm,application/vnd.ms-word.document.macroEnabled.12
.docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document
.dotm,application/vnd.ms-word.template.macroEnabled.12
.dotx,application/vnd.openxmlformats-officedocument.wordprocessingml.template
.potm,application/vnd.ms-powerpoint.template.macroEnabled.12
.potx,application/vnd.openxmlformats-officedocument.presentationml.template
.ppam,application/vnd.ms-powerpoint.addin.macroEnabled.12
.ppsm,application/vnd.ms-powerpoint.slideshow.macroEnabled.12
.ppsx,application/vnd.openxmlformats-officedocument.presentationml.slideshow
.pptm,application/vnd.ms-powerpoint.presentation.macroEnabled.12
.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation
.xlam,application/vnd.ms-excel.addin.macroEnabled.12
.xlsb,application/vnd.ms-excel.sheet.binary.macroEnabled.12
.xlsm,application/vnd.ms-excel.sheet.macroEnabled.12
.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xltm,application/vnd.ms-excel.template.macroEnabled.12
.xltx,application/vnd.openxmlformats-officedocument.spreadsheetml.template

Adding all mime-types to IIS in one step is very simple:

The easiest way to do this is stopping IIS and editing the metabase XML file (C:\WINDOWS\system32\inetsrv\MetaBase.xml) using a text editor. Search for the <IIsMimeMap Location="/LM/MimeMap" /> element and append the lines above to the MimeMap attribute

关于asp-classic - 经典 ASP 的文件扩展名问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1849441/

相关文章:

asp-classic - ASP vb编译错误800A03EA

com - 在 HTTPD 中调试 ASP 页面

php - 在返回 "Oops! This link appears to be broken."的 PHP 404 header 之后包含

python - 区分以 .dot 开头的文件扩展名和隐藏文件

arrays - 如何在vbscript中实现可变大小的数组

encryption - 通过经典 ASP 函数执行用户定义的函数

c# - 信号器/集线器和 jquery 脚本上的 404 错误

php - 尝试访问本地 LAMP 服务器上的 localhost 时出现 404 Not Found 错误

ruby - 删除文件扩展名的最佳方法

c - 实现网络电台 : trying to open '.au' file in c