MVC website - how to prevent access to static files

前端 未结 1 1692
后悔当初
后悔当初 2021-01-25 09:37

I have a MVC website, without authentication. In the website directory I have a folder \\ProjectNotes which contains a file inside, Notes.txt. Neither this folder nor the text f

相关标签:
1条回答
  • 2021-01-25 10:22

    You should use Web.Config file for your case. Add to your root Web.Config file into <system.webServer> section:

    <security>
      <requestFiltering>
        <hiddenSegments>
          <add segment="ProjectNotes"/>
        </hiddenSegments>
      </requestFiltering>
    </security>
    

    Actually, your question has nothing with MVC, but with IIS restrictions (Or other web server restrictions but I assume you using IIS)

    0 讨论(0)
提交回复
热议问题