简体   繁体   English

防止aspx文件在上传文件夹中运行

[英]Prevent aspx file run in upload folder

I'm trying to protect me from ASPX Spy attacks. 我试图保护我免受ASPX Spy攻击。

I added the configuration in the web.config in my upload directory: 我在上载目录的web.config中添加了配置:

<configuration>
    <system.web>
      <authorization>
        <deny users="*" />
      </authorization>
    </system.web>
</configuration>

But, I can still run aspx files! 但是,我仍然可以运行aspx文件!

What am i missing? 我想念什么?

EDIT: 编辑:

the web.config section authorizes only URL not file execution. web.config部分仅授权URL,而不授权文件执行。 See this link to MSDN for more details 有关更多详细信息,请参见指向MSDN的链接。

Try the following settings inside configuration which will prevent any type of file execution in upload folder: 请在configuration尝试以下设置,这将阻止在上载文件夹中执行任何类型的文件:

<location path="upload" allowOverride="false">
 <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>  

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM