Solved

Secure PDF files in Asp.net

Posted on 2010-11-08
3
507 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 13

Accepted Solution

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

Expert Comment

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

Author Closing Comment

by:WingYip
ID: 34090961
Thanks

That did it
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# MVC Insert Multiple Row into DB 2 63
VS 2015 is giving [No relevant source lines] 2 40
IIS URL Rewrite syntax 5 18
Send parameters via datatable ajax call 4 12
Lync server 2013 or Skype for business Backup Service Error ID 4049 – After File Share Migration
A phishing scam that claims a recipient’s credit card details have been “suspended” is the latest trend in spoof emails.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 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