Try this (you don't need the middle bit if you never use SSL):
On 6/8/2010 6:28 PM, Dave Burns wrote:
> In my Application.cfc's init code, I'm trying to set a variable in the
> application scope that is the base URL for the pages in the app. I need this
> to overcome some issues later with relative and absolute paths (using CF7 so
> app-specific mappings not possible). I'm having some trouble calculating this
> robustly and I wonder if I'm overlooking something simple.
>
> It's easy to get the base file path. I just use: this.rootFilePath =
> GetDirectoryFromPath(GetCurrentTemplatePath());
>
> But then I want to calc this.rootURLPath. So if the application is located in
> the docroot (e.g. d:/inetpub/mysite/), I'd just get '/'. If it were located
> elsewhere (e.g. d:/inetpub/mysite/a/b/c/), I'd get '/a/b/c/'.
>
> I can't use any of the CGI variables because at this point, we're not in the
> middle of an HTTP request. What I want is the string overlap between
> rootFilePath and CGI.script_name.
>
> Any ideas?
>
>
>
>
~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334393
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm