IIS7,web.config仅允许网站目录/上载中的静态文件处理程序 [英] IIS7, web.config to allow only static file handler in directory /uploads of website
本文介绍了IIS7,web.config仅允许网站目录/上载中的静态文件处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果有可能,我该如何修改web.config使其子目录成为静态子目录-内部文件将仅作为静态文件处理,即使其名称为"aspx"或其他名称也是如此? 谢谢.
If it's possible which I think so, How do I modify my web.config to make a sub directory static -- files inside will only processed as static file, even if its name is "aspx" or something else? Thanks.
推荐答案
将以下内容添加到包含仅希望用作静态内容的文件的文件夹中的web.config
文件中:
Add the following to a web.config
file in the folder containing the files you wish to be served only as static content:
<configuration>
<system.webServer>
<handlers>
<clear />
<add
name="StaticFile"
path="*" verb="*"
modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
resourceType="Either"
requireAccess="Read" />
</handlers>
<staticContent>
<mimeMap fileExtension=".*" mimeType="application/octet-stream" />
</staticContent>
</system.webServer>
</configuration>
这篇关于IIS7,web.config仅允许网站目录/上载中的静态文件处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文