Answer the question
In order to leave comments, you need to log in
How to prevent access to PDF files on the server via a direct link?
How to prevent access to PDF files on the server via a direct link?
Allow to open the link only if the user is already "logged in" on the site (I have some session("login")=true for example)
Classic ASP
Answer the question
In order to leave comments, you need to log in
Thank you all - decided.
URL Rewrite pattern: ^(.*).(pdf)$
<%
if session("login")=true then
z= split(Request.Servervariables("HTTP_X_ORIGINAL_URL"),"/")
Response.buffer = TRUE
Response.ContentType = "application/pdf"
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
file=server.mappath(".")+"/pdf/"+z(ubound(z))
objStream.LoadFromFile file
Response.BinaryWrite objStream.Read
else
%>
<h1 align="center">Access denied!</h1>
<%
end if
%>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question