Author Topic: How to provide access only to authenticated user to particular folder in asp.net  (Read 2379 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
I have ASP.NET web application hosted on asphostportal

I have to provide access to only authenticated users to a particular list of pdf kept in a folder "PdfFiles" in root directory.

I was trying below configuration settings in web.config, but it did not work, with this setting still this folder is accessible to all the users. I have form authenticated enabled for this site.

Code: [Select]
<location path="PdfFiles">
    <system.web>
    <authorization>
      <deny users="?" />
    <allow users="*"/>
    </authorization>
    </system.web>
  </location>

Also I noticed that anonymous authentication was enabled for "PdfFiles" folder in IIS. If I disable this, it does not allow authenticated or anonymous, any of the user to access the pdfs.

So configuration change or IIS change, none of them worked. Can any one help me out on this issue?