IIS7,web.config 只允许在网站的/uploads 目录中使用静态文件处理程序 [英] IIS7, web.config to allow only static file handler in directory /uploads of website
本文介绍了IIS7,web.config 只允许在网站的/uploads 目录中使用静态文件处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果可能的话,我如何修改我的 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 只允许在网站的/uploads 目录中使用静态文件处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文