Coldfusion 2021 loads white pages for cfm files - coldfusion

Here's some small info about the server:
Windows Server 2019
Coldfusion 2021
IIS 10
<!--- Dump out the server scope. --->
<cfdump var="#SERVER#" />
<!--- Store the ColdFusion version. --->
<cfset strVersion = SERVER.ColdFusion.ProductVersion />
<!--- Store the ColdFusion level. --->
<cfset strLevel = SERVER.ColdFusion.ProductLevel />
I've added everything in IIS, CGI, ISAPI Filters and Restrictions and I have all the handlers. I do have .cfm in the default documents. Issue I keep seeing on my test page is just a blank white screen. This was my test file coding:
What might be the issue and why am I just getting a white screen of death on all my cfm pages?
Thanks

Sounds like a disconnect between the app engine and IIS. You should look into commandbox: https://commandbox.ortusbooks.com/setup/installation
Also has BonCode connectors for IIS. https://commandbox.ortusbooks.com/embedded-server/external-web-server

Related

Active cflayoutarea element not loading source content

We have a CF 9 project that got upgraded to CF 2016 couple of weeks back. Original developers and the person who upgraded the project left our company. No one in our company ever worked with ColdFusion. So I was asked to do some research in fixing couple of bugs.
Whenever user clicks on different cflayout tabs, source content is getting disappeared after fraction of seconds. If I validate the page source code using IE developer tools, these tabs markup (markup generated by the tab sourceurl)already exists in the markup. But something is stopping this markup from appearing in UI. Can anyone please help me solve this issue?
P.S: First tab (test1) data is always appearing as expected. Other tabs content is always getting disappeared after some time.
Source code is as follows:
<cflayout type="tab" >
<cflayoutarea title="Test1">
<cfinclude template="./grids/test1Grid.cfm">
</cflayoutarea>
<cfif valuationRuns.recordCount gt 0>
<cfif StructKeyExists(URL,'ID')>
<cfset variables.ID = '&ID='&URL.ID>
<cfelse>
<cfset variables.ID = ''>
</cfif>
<cflayoutarea title="Valuation Summary" source="./valuations.cfm?test_record_id=#testId#&test_name=#URLEncodedFormat(test_name)#&runId=summary"
refreshonactivate="true" overflow="hidden" style="height:570px;" ></cflayoutarea>
<cfloop query="valuationRuns">
<cfset RunID = valuationRuns.RunId[currentrow]>
<cfset RunName = valuationRuns.RunName[currentrow]>
<cflayoutarea title="Run #valuationRuns.RunId[currentrow]##IIF(Left(valuationRuns.RunName[currentrow],5) NEQ 'RunID',DE(' - #valuationRuns.RunName[currentrow]#'),DE(''))#" source="./valuations.cfm?test_record_id=#testId#&test_name=#URLEncodedFormat(test_name)#&runId=#RunId#&runName=#URLEncodedFormat(RunName)##IIF(StructKeyExists(URL,'ID'),DE('#variables.ID#'),DE(''))#"
refreshonactivate="true" overflow="hidden" style="height:570px;" ></cflayoutarea>
</cfloop>
</cfif>

CFGRID bind in HTML format does not work in Coldfusion 11

OK, so I've spent the last couple of days researching this issue on various websites including this one and I'm still no closer to having an answer. I have seen claims that this was a bug and was fixed on Adobe's end in one of the CF11 patches and I have even seen one answer that claimed that Adobe was emailing the fix directly to individuals - though no information on how to go about getting Adobe to do that was provided on that webpage.
We just updated our intranet to Coldfusion 11 and pages that have a cfgrid using the HTML format and bind data from a cfc no longer show the cfgrid on the page. Other pages that use the Flash format with cfgrid (which apparently can't use the bind attribute with Flash) do work. These HTML cfgrid pages were working properly in Coldfusion 9 before we migrated to 11.
I have simplified the code as much as I can to eliminate other error possibilities - i.e. I've stripped out formatting and am pulling only a couple columns from the database. Here is the code I am currently working on in my dev sandbox:
<cfgrid format="html"
name="userGrid"
bind="cfc:editorFunc.getGridData({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})"
pagesize="20">
<cfgridcolumn name="REGION" header="Region">
<cfgridcolumn name="managmentArea" header="Management Area">
</cfgrid>
Here is the code in the cfc (the query does produce results when dumped to the page):
<cffunction name="getGridData" access="remote">
<cfargument name="page">
<cfargument name="pageSize">
<cfargument name="gridsortcolumn">
<cfargument name="gridsortdir">
<cfquery name="records" datasource="webData">
SELECT REGION, managmentArea
FROM areaDesc
ORDER BY Region ASC
</cfquery>
<cfset result = queryConvertForGrid(duplicate(records), arguments.page, arguments.pagesize)>
<cfreturn result>
</cffunction>
Has anyone had any luck getting a cfgrid like this to work in CF11? I could try a JQuery solution like JGrid, however I would prefer to figure out the existing issue with this code if possible.
Any help is much appreciated.
Add this..
<cfif not len(trim(arguments.gridsortcolumn))>
<cfset arguments.gridsortcolumn = "REGION">
<cfset arguments.gridsortdir = "desc">
</cfif>
query....
ORDER BY #arguments.gridsortcolumn# #arguments.gridsortdir#

Dynamic Subdomains - ColdFusion 11

Anyone know a way to create dynamic subdomains in coldfusion 11 without having to add them to a dns server?
I want to be able to redirect each of my clients in a personalized subdomain every time they log in to my system.
ex: client1.example.com client2.example.com
This works if your site is hosted in a Windows IIS server.
If you are using IIS then the following can help you. Use loops and conditions as your requirements.
<!--- Provide you IIS SiteName --->
<cfset siteName = "Your IIS Site Name">
<!--- Your new domain address --->
<cfset newSiteBinding = "client2.example.com">
<!--- your port address --->
<cfset newSitePort = 80>
<cfset fileID = createUUID()>
<cfsavecontent variable="ex"><cfoutput>cd %windir%\system32\inetsrv
%windir%\system32\inetsrv\APPCMD set site /site.name: #siteName# /+bindings.[protocol='http',bindingInformation='*:#newSitePort#:#newSiteBinding#']</cfoutput>
</cfsavecontent>
<cffile action = "write"
file = "E:\#fileID#.bat"
output = "#ex#"
/>
<cfexecute name="E:\#fileID#.bat"
arguments="/c set"
variable="data"
timeout="10"
/>
<cffile action = "delete"
file = "E:\#fileID#.bat"
>
What we are basically doing is that we are creating a .bat file and executing it using cfexecute. Please note that you need to be careful with the paths because the Directory structure might be different in your server.
.BAT file content Example
cd %windir%\system32\inetsrv
%windir%\system32\inetsrv\APPCMD set site /site.name: example /+bindings.[protocol='http',bindingInformation='client2.example.com:80:*']
How the command works. Notice the + at /+bindings?
That means adding a new binding and /-bindings tries to remove an existing binding.

Is a CFLogin replacement necessary or am I missing something?

I'm seriously considering moving away from CF8 cflogin because it is tied to the server that spawned the login. In a load balanced environment you're stuck with sticky sessions if you don't do a custom implementation.
Does anyone have any source that mimics CFLogin that writes to and is managed from the client scope? Maybe even a design that matches up well with a rename replace on isuserin[any]role.
What should I be thinking about when I consider writing a replacement implementation for CFLogin?
Here is a basic non cflogin approach using variables stored in the CLIENT scope. We use a similar approach for non-sticky sessions across our server cluster behind our load balancer.
This code should live in Application.cfc -> onRequestStart() method:
<!--- handle login *post* --->
<cfif structKeyExists(FORM, "pageaction") and FORM.pageAction eq "adminlogin">
<!--- attempt to log user in --->
<cfif loginSuccessful>
<!--- Set client variables for session management --->
<cfset CLIENT.lastHit = now() />
<cfset CLIENT.loggedIn = 1 />
<!--- redirect to home page --->
<cfelse>
<!--- redirect to login page with message --->
</cfif>
<!--- all other requests, except for the login page --->
<cfelseif structKeyExists(CLIENT, "lasthit") and structKeyExists(COOKIE, "cfid") and structKeyExists(CLIENT, "cfid") and listLast(CGI.SCRIPT_NAME, "/") neq "login.cfm">
<!--- Check for timeout --->
<cfif (datediff("n", CLIENT.lastHit, now()) lte 10) and (CLIENT.loggedIn is 1) and (CLIENT.cfid is COOKIE.cfid)>
<!--- record last hit --->
<cfset CLIENT.lastHit = now() />
<cfelse>
<!--- timeout! redirect to login page --->
<cflocation URL="http://mydomain/login.cfm" addtoken="false" />
</cfif>
</cfif>
There is user role stuff, but I hope this helps as a starting point.
I customized the CF Login Wizard through Dreamweaver to be portable and to use a db table for authentication and role management. Because of this,I can use it either as a single-user login, or multiple account logins. I never have used cflogin and haven't needed to. I just drop the files into the directory, customize the login credentials, and that is it. Works perfect every time.

Coldfusion GetHttpRequestData()?

Does anyone have an example of how Coldfusion's GetHttpRequestData() works? I'm looking to use this func to save data from the AJAX Upload script: http://valums.com/ajax-upload/
The script works in FireFox but not Safari, Chrome, etc...
Ideas?
What error do you get?
Maybe these links will help:
http://www.coldfusionjedi.com/index.cfm/2007/7/1/Undocumented-change-to-GetHTTPRequestData-in-ColdFusion-8
http://www.bennadel.com/blog/1602-GetHTTPRequestData-Breaks-The-SOAP-Request-Response-Cycle-In-ColdFusion.htm
You might also want to read this recent thread about that script. As valums suggested, you should be able to extract the binary data from getHttpRequestData().content (when needed).
In my very limited tests, it seemed to work okay with IE8/FF/Chrome/Opera. However, I had no luck with Safari (windows). It seemed like the request data was getting mangled (or possibly misinterpreted by CF?). So the final content-type header reported by CF was incorrect, causing an http 500 error. Granted, I did not test this extensively.
Here is my quick and dirty test script (lame by design...)
<cfset uploadError = "" />
<cfif structKeyExists(FORM, "qqFile")>
<!--- upload as normal --->
<cffile action="upload" filefield="qqFile" destination="c:/temp" />
<cfelseif structKeyExists(URL, "qqFile")>
<!--- save raw content. DON'T do this on a prod server! --->
<!--- add security checks, etc... --->
<cfset FileWrite( "c:/temp/"& url.qqFile, getHttpRequestData().content) />
<cfelse>
<!--- something is missing ...--->
<cfset uploadError = "no file detected" />
</cfif>
<!--- return status old fashioned way (for compatibility) --->
<cfif not len(uploadError)>
{"success": true}
<cfelse>
<cfoutput>{error": "#uploadError#"}</cfoutput>
</cfif>
You want to look into using cffile with action="upload" to upload the file: http://cfdocs.org/cffile
GetHttpRequestData() is intended for decoding protocols like SOAP, XML-RPC, and some of the more complex REST-ful protocols. HTTP file uploads are normally done as POSTs using the multipart/form-data MIME type. Looking at http://www.cfquickdocs.com/it doesn't appear that GetHttpRequestData() has any special support for multipart data, which means you'd have to split and decode the parts yourself. Not my idea of fun, and completely unnecessary if you're just doing file uploading.
<cffile action="upload"> or <cffile action="uploadAll"> (new for CF9) should be quite sufficient for processing file uploads, even for those done via an AJAX upload script.