Deny access to html page

前端 未结 1 1908
刺人心
刺人心 2020-12-21 08:10

I have ASP.NET Web Forms project. I created a folder Demo in this project and put in this folder HelloWorld.html. I need deny access to this

相关标签:
1条回答
  • 2020-12-21 08:43

    Your web.config is correct. The problem is this secures files that are going through the ASP.NET pipeline. Certain static files, like html files, are served up directly by IIS and so it is bypassing your security.

    You can force static files to go through the ASP.NET pipeline by adding a handler for them under the <system.webServer> section of your web.config:

    <handlers>
        <add name="HTMLHandler" type="System.Web.StaticFileHandler" path="*.html" verb="GET"  />
    </handlers>
    
    0 讨论(0)
提交回复
热议问题