WingYip
asked on
Secure PDF files in Asp.net
Hi
We are using forms authentication in .net to restrict access to tthe site. We also need to restrict access to a directory containing PDF files.
I have done the following
Added the web.config file in the attached code snippet to this directory
In the mappings section of IIS app configuration I have added .pdf as an application extension.
restarted iis
However what happens is this.
When clicking on a link to one of the secured pdf files, we are redirected to the login page which is what I want to happen.
However, once logged in, the links to the pdf files cause a 'cannot display page' error in ie.
So the files are being secured but they can no longer be displayed even when logged in
Anyone any ideas
Wing
We are using forms authentication in .net to restrict access to tthe site. We also need to restrict access to a directory containing PDF files.
I have done the following
Added the web.config file in the attached code snippet to this directory
In the mappings section of IIS app configuration I have added .pdf as an application extension.
restarted iis
However what happens is this.
When clicking on a link to one of the secured pdf files, we are redirected to the login page which is what I want to happen.
However, once logged in, the links to the pdf files cause a 'cannot display page' error in ie.
So the files are being secured but they can no longer be displayed even when logged in
Anyone any ideas
Wing
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think the Deny users="?" is denying everyone -- you need an allow list in there somewhere.
ASKER
Thanks
That did it
That did it