troubleshooting Question

ASP.NET - Forms Authentication for a directory of PDF files on the web server

Avatar of JosephEricDavis
JosephEricDavis asked on
.NET ProgrammingC#ASP.NET
1 Comment1 Solution253 ViewsLast Modified:
I'm using forms authentication on my web server which I'm setting up in my web.config file like this...

<location path="Account">
            <system.web>
                  <authorization>
                        <deny users="?"/>
                  </authorization>
            </system.web>
      </location>

This effectively blocks all unauthenticated users from accessing any of the pages inside the Account folder.

So now I'm trying to restrict all unauthenticated users from accessing any of the PDF files inside of the directory called Attachments, which exists in the same directory as Account.  I've done this...

<location path="Attachments">
            <system.web>
                  <authorization>
                        <deny users="?"/>
                  </authorization>
            </system.web>
      </location>

But I am still able to access pdf files inside that directory as an unauthenticated user.  Is this even possible or does it only work for the web forms?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros