ASP.NET Identity - protecting a directory from unauthenticated users

筅森魡賤 提交于 2019-12-06 07:26:25

The solution to this for my environment was to use the web.config file in the sub directory, but to add a custom handler definition for the file types in question.

<?xml version="1.0"?>
<configuration>
    <system.web>
      <authorization>
        <deny users="?" />
      </authorization>
    </system.web>
  <system.webServer>
    <handlers>
      <add name="PDFHandler" verb="*"
        path="*.pdf"
        type="System.Web.StaticFileHandler"
        resourceType="Unspecified" />
    </handlers>
  </system.webServer>
</configuration>

The web server then allows authenticated users only to access the files in the sub directory.

This article led my to the solution: http://www.primaryobjects.com/CMS/Article112

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!