Take the 2-minute tour ×

We have a website that requires a username and password. Once logged in, the user can select a link to a PDF in the web browser. Once this has happened they are able to see the full URL path of the PDF, they could copy and paste the path into a different browser without logging in, or send the address to someone else to look at.

I am asking this for a co-worker so I am not too sure on what is needed, but they want to change it from say "documents/customerlist.pdf" to "documents/info.asp" (not sure what the file type should be, maybe just "documents/info"?) I think that is what the goal is. Is this possible? If someone could point me in the right direction we might be able to figure it out!

share|improve this question
Tim, how are you getting on with this? –  halfer Jun 25 '12 at 20:41
Good, the URL rewriting was nice. I didn't even know that was possible! Thanks –  Tim G Jun 27 '12 at 12:53
Yes, it's not so well known that there are a number of rewrite approaches for ASP. Handy to know! –  halfer Jun 27 '12 at 13:17
add comment

1 Answer

up vote 0 down vote accepted

I should think you can do this in ASP. You'll need to deliver the PDF dynamically via an ASP page, which detects the user's session and only serves the data if they are suitably authenticated (so copying the URL to a different browser/machine will result in a 404 or access denied, as you wish). You'll need to read the data from file and binary-write it to the browser, and set HTTP headers for mime-type, content length etc.

I'd start off with serving it on a pdf.asp?file=customerlist URL, but you can later experiment with changing this to something more readable (docs/customerlist.php). You'll need to look into URL rewriting here.

So, that's the general approach. If you do a web-search around these topics ("ASP serve binary file", "ASP URL rewriting") you are sure to get plenty of examples.

share|improve this answer
add comment

Your Answer


