Hi,
I looked on CFLIB for a function that would return the
current URL. I found a really neat one which doesn't use the
sometimes unreliable cgi variables.
It goes something like this:
<cffunction name="getCurrentURL" hint="Gets the current
URL" returntype="string" output="false" access="public">
<cfset var currentURL =
getPageContext().getRequest().GetRequestUrl().toString() />
<cfif len(trim(cgi.query_string))>
<cfset currentURL = currentURL & "?" &
cgi.query_string />
</cfif>
<cfreturn currentURL />
</cffunction>
If I call this on like a top level index.cfm it works
perfectly...however, if I put this function into a CFC, I get an
odd string returned looking something like:
cfutils2ecfc1871686742$funcGETCURRENTURL@666b79
There's no error, but the string it sends back is clearly
very odd.
Is there a way to use this function within a CFC? I figured
it made sense as I would be using something like this quite a lot
and don't want to repeat myself.
Many thanks,
Mikey.