如果我认为可能的话,如何修改我的 web.config 以使子目录静态 - 里面的文件将仅作为静态文件处理,即使其名称是“aspx”或其他名称? 谢谢。
最佳答案
将以下内容添加到包含您希望仅作为静态内容提供的文件的文件夹中的 web.config
文件:
<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>
关于security - IIS7,web.config 仅允许静态文件处理程序位于网站的目录/上传中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2061678/