Actually I disagree with what you are saying here, first I would not be putting the authentication in the Application.cfm and instead look at securing it some other way. But that is not your issue.
The issue is that you are trying to run a template that will throw an error, nothing that I can think of from the top of my head will ever get around that. Your best option would be to use the template in question with url parameters with the name of the file. Then in that template check the authentication and then pass the name of the PDF and use cfcontent to actually load a PDF back to the browser. Your method is just asking for more headaches like this. But I am at a loss to explain how a PDF is going to throw a CF Exception error, when using cfcontent to deliver the file it should not be trying to compile that content. Regards, Andrew Scott http://www.andyscott.id.au/ > -----Original Message----- > From: Claude Schnéegans <schneeg...@internetique.com> [mailto:=?ISO- > 8859-1?Q?Claude_Schn=E9egans <schneegans@interneti=71?= =?ISO-8859- > 1?Q?ue.com=3E?=] > Sent: Thursday, 23 June 2011 1:12 AM > To: cf-talk > Subject: Re: application.cfm > > > >>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:345525 > Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm > Unsubscribe: http://www.houseoffusion.com/groups/cf- > talk/unsubscribe.cfm ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:345529 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm