Here's how I would approach this. First, if you are dead set on having the link to the pdf appear as a regular 'pdf' link, create a url rewrite rule (using either mod_rewrite in Apache, an IIS isapi extension for IIS, or another mechanism if you are using some other webserver). The mod_rewrite rule might look something like this (not checked for accuracy):
RewriteEngine On RewriteRule ^somefakedownloaddir/(.+?)\.pdf$ processPdfRequest.cfm?file=$1[L] In other words, you can download the pdf by accessing: http://myserver.com/processPdfRequest.cfm?file=/path/to/my.pdf (or a more suitable URL should you be using a framework, etc.) In your 'processPdfRequest.cfm' or somewhere in your request cycle, you can check access rights and file existence. Then, if all is good, serve the file using cfcontent (again, unverified code): <cfheader name="Content-Disposition" value="attachment; filename=fileNameThatTheUserSees.pdf" /><!--- if you want it to force download ---> <cfcontent type='application/pdf' file='/server/path/to/my.pdf' /> HTH Dominic On 22 June 2011 16:12, <> wrote: > > >>The CFML must be compiled in order for Java to execute it > > Sure, but actually I don't want to execute the file, nor compile it. > Yhe file is actually a pdf file under .cfm extension. > This is to force execution of an application.cfm first in which I check if > the user is authorized to open the file. > If yes, the application.cfm returns the document with the correct name and > headers, > if not, it returns an error message. > This way, documents cannot be opened directely. > > I've been using this trick for years, until this morning a user loaded some > document containing by chance characters <cf... in its binary part. > This causes a compilation error, this is how I figured out that the document > was compiled prior application.cfm was called. > > I'm affraid I'll have to completely redesign my document retreiving system. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345562 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm