1 Reply Latest reply on May 4, 2007 1:53 PM by pblecha

    onRequest() and PDF files

      I'm trying to configure the onRequest() method to filter called pages based on roles that I set in the onSessionStart() method. For testing purposes, though, I've commented out the session variable I'm using to set that role. What's happening now is, I am simply unable to open a PDF file using the onRequest() method. Here's the code from my Application.cfc:

      <cffunction name="onRequest" returntype="boolean">
      <cfargument type="string" name="targetPage" required="yes" />
      <cfif arguments.targetPage contains "pricing/">
      <cfinclude template="#arguments.targetpage#">
      <cfif Session.UserRole is "Admin" or Session.UserRole is "Distrib">
      <cfinclude template="#arguments.targetPage#">
      <cfinclude template="index2.cfm">
      <cfinclude template="#arguments.targetpage#">
      <cfreturn true>

      As long as it is a web page being called, it opens just fine; but if I try to open a PDF file, it tries to ask for a login, but even when I do this properly, it gives me an error! I've tried to figure out how to configure IIS to quit asking for login info. It's not working, but why can I not call PDFs through onRequest()?
        • 1. Re: onRequest() and PDF files
          pblecha Level 1
          Sorry... duhhh... answered my own question.

          Note to self: You can't pass PDFs into a CFINCLUDE tag.

          I put a CFIF statement in to test for what kind of file it was and passed the PDF to a CFLOCATION tag, and it works just fine.

          Sorry for the inconvenience. Hope this helps someone else.