Skip to main content
Known Participant
February 10, 2012
Question

Problem with Application.cfc

  • February 10, 2012
  • 3 replies
  • 1280 views

I have site that I am trying to use Application.cfc but I am having trouble with two things.  First I want to put all my cfc in one folder called cfc but I dont know how to map cfc in the application.cfc.  Second I am having trouble getting page that are two folders down in the site to use the error pages I keep getting a 500 errror.  Can anyone help me with these two problems?  Thanks.

    This topic has been closed for replies.

    3 replies

    BKBK
    Community Expert
    Community Expert
    February 11, 2012

    TheScarecrow wrote:

    I want to put all my cfc in one folder called cfc but I dont know how to map cfc in the application.cfc. 

    12Robots wrote:

    In your Application.cfc you can map the cfc folder by adding this to the pseudo-constructor area

    <cfset this.mappings["/cfc"] = [the absolute path to the folder] /> (edited to: 'folder' )

    I usually leave out the forward slash, and do this instead this.mappings["cfc"]. In any case, that setting will probably fail if you haven't enabled its use in the Administrator. To do so, navigate in the Administrator to Server Settings => Settings. Ensure that the box 'Enable Per App Settings' is checked. Click to 'Submit Changes'. I usually restart ColdFusion after changes like these, to restart the application.

    12Robots
    Participating Frequently
    February 11, 2012

    In your Application.cfc you can map the cfc folder by adding this to the pseudo-constructor area

    <cfset this.mappings["/cfc"] = [the absolute path to the foler] />

    As for your other issue, you said: Second I am having trouble getting page that are two folders down in the site to use the error pages I keep getting a 500 errror

    What error pages?  Site wide error handlers?  Did you use <cferror somewhere to define something?  Are you using onError?  I think we need a bit more information. Do these subfolders that are having issues have Application.cfc or Application.cfm file sof their own?

    Known Participant
    February 11, 2012

    I have these error pages

    <cferror type="Request" template="ErrorRequest.cfm"

               mailto="user@place.com>

      <cferror type="Exception" template="ErrorException.cfm"

               mailto="user@place.com">

              <cferror type="exception" template="404.cfm"

                            mailto="user@place.com">

    no they do not have their own Application.cfc

    BKBK
    Community Expert
    Community Expert
    February 11, 2012

    TheScarecrow wrote:

    I have these error pages

    Don't you mean cferror tags?

    <cferror type="Request" template="ErrorRequest.cfm"

               mailto="user@place.com>

      <cferror type="Exception" template="ErrorException.cfm"

               mailto="user@place.com">

              <cferror type="exception" template="404.cfm"

                            mailto="user@place.com">

    no they do not have their own Application.cfc

    So the files ErrorRequest.cfm, ErrorException.cfm and 404.cfm are, like Application.cfc, also in the root of the site? Did you place the cferror tags in the so-called pseudo constructor section of the application CFC? You should.

    Owainnorth
    Inspiring
    February 10, 2012

    Application.cfc has to be in your website root. Doing so should solve both issues.

    Known Participant
    February 11, 2012

    I have done that it does not solve the problem.  I still get errors on both fronts.