Solved

Secure PDF files in Asp.net

Posted on 2010-11-08
3
501 Views
Last Modified: 2012-06-27
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
<?xml version="1.0" encoding="utf-8"?>

<configuration>

	<system.web>

		<authorization>

			<deny users="?" />

		</authorization>

	</system.web>

</configuration>

Open in new window

0
Comment
Question by:WingYip
3 Comments
 
LVL 13

Accepted Solution

by:
devlab2012 earned 500 total points
Comment Utility
add a line <allow users="*" /> in authorization section
0
 
LVL 3

Expert Comment

by:mortimer452
Comment Utility
I think the Deny users="?" is denying everyone -- you need an allow list in there somewhere.
0
 
LVL 1

Author Closing Comment

by:WingYip
Comment Utility
Thanks

That did it
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
popup message 3 26
How do write this URL Rewrite Rule for IIS 3 62
Redirect rewrite back to same address 3 41
Duplicate a row 2 28
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now