I have an asp.net website, using .Net 4.0, and IIS 7.5, and using Classic Pipeline Mode in the Application Pool.
I'm using forms authentication, and the authorization setting in the web.config at the root folder of the website allows all users.
In a subfolder's web.config, I am setting authorization for that folder and its contents to block all anonymous users.
There is a pdf file in that subfolder, and even though I am denying anonymous users, I can read the pdf file and download it.
I am trying to block anonymous access to pdf files, and all of the examples I've found on how to do this are not working for me.
How can I block anonymous access to pdf, word, excel, and other files?
StaticFileHandlerbefore checking the authorization rules defined in the web.config. Running in Integrated Pipeline mode would allow the requests to be run through managed code, allowing you the opportunity to deny access to files by implementing logic in managed code in e.g. aHttpModule(but IIRC, running in Integrated Pipeline mode will obey the authorization rules defined in config)