ColdFusion Application without mentioning application name on Application.cfc

215 views Asked by At

On every weekend I spend some time to learn ColdFusion. This weekend also, I have planned to create one application. So, First, I just write to start the Application.cfc. Suddenly, I'm thinking about 'Can we able to create a application without application name?'.

I know the importance of the application name. But, I just tried the below steps,

  1. Create a new folder in the web root called 'testApplication'.
  2. Inside, just create Application.cfc and index.cfm file.
  3. In the Application.cfc just write below code,

        component output="false" {      
            public any function onApplicationStart() {
                Application.user = "jawa";  
            }  
        }
    
  4. And, Inside of the index.cfm file, I just dump the Application scope.

After running the application, I get the below result from Application scope dump.

enter image description here

I'm expecting, it is throwing an error like

'Application name is required or some other errors'

. But, the application was run without application name on CF server.

Guys, Do you know how this is working?

1

There are 1 answers

1
jawahar N On

For the above question, I searched with CF docs and found the solution.

For security reasons, CF prevents the creation of unnamed applications by default. However, the ColdFusion Administrator exposes the setting for this under Server Settings. Please see the below sample screen.

enter image description here

By default, this flag is not enabled on ColdFusion which means we can able to create an application without mentioning application name on Application.cfc

But, if we enabled this flag means, we couldn't able to create an application without application name. it's throwing an error. Please see the below screenshot.

enter image description here