I am hosting MODx on an IIS Server.
I store all my .PDF Files in a folder called /secure/somefoldername/filename.pdf
Is there a way that I can use MODx to prevent users from directly linking to the .PDF and redirect them to my secure signin page first.
I am using ISAPI Rewrite an for IIS and it redirects users to my secured_document.html when they click on a link.
I then built wrote code that checks if my user is logged in and redirects them to the .pdf after they login or gives them a link to click if they are already logged in.
But if I paste the link to that same .pdf in the browser, I can’t stop them from accessing the document.
ANY HELP WOULD BE GREATLY APPRECIATED.
I have tried HELICON HOTLINK BLOCKER, but when this ISAPI Filter is activated all my .PDF seem to hang when the user tries to access them.
Jason.
Jason Buck
-
☆ A M B ☆
- 711 Posts
I used this on a website recently.
http://modxcms.com/extras/package/?package=147
We added each PDF as a page in MODx then linked to the MODx Page, which had the appropriate security groups applied i.e. members only.
Aaron
-
☆ A M B ☆
- 711 Posts
The snippet I suggested can hide the true URL of the document so even if a member does give out the link, it will only be to the MODx protected page URL.
http://modx.scottydelicious.com/blog/2008/06/15/filedownloadpe
Have a look at this link:
Download Same file, different URI: Downloaded 1119 times.
http://modx.scottydelicious.com/downloads/random-name-whatever.zip
As an example, I duplicated this document (The new document’s ID is 37) and gave it an alias of random-name-whatever.zip. As you can see, the URI does not need to match the actual file name. It can be whatever you want. The actual file was uploaded to the root of my site, but you can put your files in any web accessible folder.
Let me know if you get stuck, we had exactly the same requirements as you do for a client and this works a treat for them.
Aaron