Print Page | Close Window

Password Protection

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=26405
Printed Date: 29 March 2026 at 8:34pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Password Protection
Posted By: dwhite02
Subject: Password Protection
Date Posted: 15 October 2008 at 3:48am
Is there a way to password protect access to files such as PPS/PPT & PDF in an IIS without the need to apply security to the files themselves or directory security?

I am using ASP with a DB backend to log users onto the site and determine which links that they have access to but I am concerned about them passing on direct URL's to the no web page files.

Any suggestions on how to do this? Is it even possible?

Thanks.



Replies:
Posted By: mhanif
Date Posted: 15 October 2008 at 7:21am
Those PPT PDF etc files are available for download for your logged members ? And you want only your logged members to download them ?  Or those files are not for download, they open it through IE.


Posted By: WebWiz-Bruce
Date Posted: 15 October 2008 at 9:43am
You could use the ADO.Stream object to stream the files to the user using an ASP page.

This way you can place the files on the server in a non public directory, you then use an ASP page to stream the files. The ASP page can then have extra checking, like to check if the user is logged in.


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: dwhite02
Date Posted: 20 October 2008 at 12:09am
Thanks Bruce,
 
I have got the PDF streaming sorted, but am having problems with the PPS/PPT files as the code below is forcing a file a download diolouge for the ASP file. Any suggestions?
 
Thanks
 
------
 
< mailto:%@LANGUAGE=VBSCRIPT - %@LANGUAGE="VBSCRIPT " CODEPAGE="65001"%>
<%
dim path
path = request.QueryString("file")
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd - http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns=" http://www.w3.org/1999/xhtml - http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<%
Response.ContentType = "application/mspowerpoint"
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.LoadFromFile "e:\xxx\xxx\" + path  'outside web root
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
%>
</body>
</html>



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net