title: How to deny access to a file with ASP.NET web config but not just locally?
body: <p>I have a problem with ASP.NET web configuration file. I want to deny some users or roles to accessing a specific PDF file. I am using ASP.NET membership and role management system. So I added this lines of codes to a Web.config file:</p>
  
  <pre><code>&lt;location path="myfile.pdf"&gt;
      &lt;system.web&gt;
          &lt;authorization&gt;
              &lt;allow roles="admin"/&gt;
              &lt;deny users="*"/&gt;
          &lt;/authorization&gt;
      &lt;/system.web&gt;
  &lt;/location&gt;
  </code></pre>
  
  <p>and put it to the directory witch the file is included in it. Now when I run the project in local system I can not access the PDF file wile I login with "admin" role. But when I publish the project on the web server I can not brows the folder but I can view the PDF file when I browse complete path to the PDF file. So:</p>
  
  <p>I can not access: <a href="http://www.example.com/folder" rel="nofollow noreferrer">http://www.example.com/folder</a></p>
  
  <p>but I can view: <a href="http://www.example.com/folder/myfile.pdf" rel="nofollow noreferrer">http://www.example.com/folder/myfile.pdf</a></p>