ColdFusion code to get current Domain

Below simple function can be used to find the current domain, by calling this wherever required.


<cffunction name="GetCurrentDomain" access="public" output="false" returntype="string"
       hint="Get Current Domain">
       
         <cfset domain="" />
         <cfset proto ="http" />
         <cfif CompareNoCase(CGI.HTTPS , 'on') EQ 0>
              <cfset proto = "https" />
         </cfif>
         <cfset domain = proto&'://'&CGI.server_name&'/' />

        <cfreturn domain />

/cffunction>

Comments

Popular posts from this blog

how to add new line in google form questions | Fix for next line issue in google form questions

How to add new line in dropdown type question in google forms