Apr 15
Application naming when using the admin api
Posted by James Netherton | Sunday 15 April 2007 12:36 PM | In ColdFusion
Application naming is usually a bit of a no brainer. You give the application a name that's meaningful and unique so that it doesn't conflict with any other apps that may be running on the server.
If an application makes use of any ColdFusion admin api features, the name given to an application could potentially be an issue. For example:
<cfset adminObj = createObject("component","cfide.adminapi.administrator")/>
<cfset adminObj.login("password")/>
Normally, the application name I used in the example is perfectly legal. But try to invoke the authentication method on the administrator component and you'll end up with something like:
The string "COOKIE.CFAUTHORIZATION_bad-application-name" is not a valid ColdFusion variable name.
So the administrator component has tried to use the application name we specified, in conjunction with the string "CFAUTHORIZATION_", in order to set an authorization cookie. It's failed because ColdFusion variables cannot contain hyphens.
Remove the hyphens from the application name and everything works as expected.
1 Comment
[Post comment]
1
Posted by charlie arehart | Saturday 28 July 2007 10:50 AM
Ouch! Very good catch. Thanks for sharing. :-)