• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CF10 Cflocation Tag Not Working

Participant ,
Jan 05, 2015 Jan 05, 2015

Copy link to clipboard

Copied

Does anyone know what to do to fix a non-working <cflocation> tag?

Upgrading web site from WS2003 ColdFusion 8 to WS2008/64bit ColdFusion 10. Upgrading CF application has required a number of CF code  and database tweaks. Application is processing normally with the following exception

Working on site upgrade few days ago, one <cflocation> tag in web application stopped transferring to its target page.  I've placed <p> debug statements before and after the <cflocation> tag in question; and <p> debug statement at the start of the target page.  the <p> before <cflocation> displays.  But then the page ends without transferring.  No error is indicated by either CF, CF logs, or the web server.

Could this be an server application pool problem?  IIS is using DefaultAppPool application pool.

I've verified Cookie session is maintained.  Also adding CF10's SessionRotate() to application home page, made no change to <cflocation> tag's failure to process.

I'm stumped, and any help is appreciated.   Thanks

Views

1.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Jan 05, 2015 Jan 05, 2015

Problem solved!

Adobe CF10 online documentation (cflocation - ColdFusion, English documentation - Adobe Learning Resources),  states:

... This tag has no effect if you use it after the cfflush tag on a page. ...

I had added numerous cfflush tags during the debugging process to "push out" data attributes before later source code errors occurred.

Removing  all cfflush tags from the source code enabled cflocation to again start working!

Votes

Translate

Translate
Advocate ,
Jan 05, 2015 Jan 05, 2015

Copy link to clipboard

Copied

Maybe supply a code sample. I have not had any problems with CFLOCATION in any CF version -- and I use it a lot. The CFLOCATION tag simply tells the web server to respond with a 302 redirect. Now it is possibly to have some logic in your application.cfm or application.cfc that can interfere with the response -- particularly around onRequestEnd code.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 05, 2015 Jan 05, 2015

Copy link to clipboard

Copied

Site Application.cfm file has no onRequestEnd code. Is this handled in Application.cfm file as <cffunction> (<cffunction name="onRequestEnd"> ...  </cffunction> ) ?


Program Code:

315

316    <cfset thisIDList = left(trim(thisIDList), len(thisIDList) - 1)>

317 <p><cfoutput>before: cflocation url="dsp_complete.cfml?eventlist=#thisIDList#" (thisIDList = [#thisIDList#"]).</cfoutput></p>

318 <cfinclude template="/includes/cfdump_all.cfm">

310 <cflocation url="dsp_complete.cfml?eventlist=#thisIDList#" addtoken="No">

320 <output>after: cflocation url="dsp_complete.cfml?eventlist=#thisIDList#" (thisIDList = [#thisIDList#"]).</cfoutput></p>

321 ...

Web Output:


     :

     :

Module(1) "frm_confirm" returned from "SdpTicketSend.cfm".

Module(1) "frm_confirm" finished cfloop query="getinit".

before: cflocation url="dsp_complete.cfml?eventlist=76438" (thisIDList = [76438"]).

  

cfdump_all.cfm:cgi - struct

etc.     :

Web Display:

Note

Note: page's footer links (below "box") are not output.

First displayed line in target <cflocation> :

147 <p>(3) In "dsp_complete.cfml" Start...</p>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 05, 2015 Jan 05, 2015

Copy link to clipboard

Copied

Your code raises a number of issues.

1) Is the above code an excerpt of Application.cfm? If so, then its structure is problematic, given that the code on that page runs at the beginning of every request.

GuyMcMickle wrote:

Site Application.cfm file has no onRequestEnd code. Is this handled in Application.cfm file as <cffunction> (<cffunction name="onRequestEnd"> ...  </cffunction> ) ?

2) When you use Application.cfm and wish to implement business code at the end of requests, the functionality to use is the CFM page onRequestEnd.cfm. Application.cfm, like onRequestEnd.cfm, is not a CFC. Using <cffunction> in either file is meaningless.

316    <cfset thisIDList = left(trim(thisIDList), len(thisIDList) - 1)>

317 <p><cfoutput>before: cflocation url="dsp_complete.cfml?eventlist=#thisIDList#" (thisIDList = [#thisIDList#"]).</cfoutput></p>

318 <cfinclude template="/includes/cfdump_all.cfm">

310 <cflocation url="dsp_complete.cfml?eventlist=#thisIDList#" addtoken="No">

320 <output>after: cflocation url="dsp_complete.cfml?eventlist=#thisIDList#" (thisIDList = [#thisIDList#"]).</cfoutput></p>

3) Why place code that has the current page context before and after the cflocation tag? After all, ColdFusion will redirect to the page dsp_complete.cfml.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 05, 2015 Jan 05, 2015

Copy link to clipboard

Copied

Before/after CF (<p>,<cfinclude>,...) is added only for current debugging purpose; not part of the actual design. 

Application currently does not use any CF OnRequestEnd functionality.  I was really wondering, as a secondary question, where an OnSessionEnd() might be implemented, considering users typically just close their browser window...

Application is using <cflocation> tag context on almost every page.  This one page is the only one exhibiting the problem.

I've also tried completely retyping the <cflocation> line to eliminate any non-printing characters. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 05, 2015 Jan 05, 2015

Copy link to clipboard

Copied

Problem solved!

Adobe CF10 online documentation (cflocation - ColdFusion, English documentation - Adobe Learning Resources),  states:

... This tag has no effect if you use it after the cfflush tag on a page. ...

I had added numerous cfflush tags during the debugging process to "push out" data attributes before later source code errors occurred.

Removing  all cfflush tags from the source code enabled cflocation to again start working!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 06, 2015 Jan 06, 2015

Copy link to clipboard

Copied

LATEST

Interesting. I never use cfflush so I'll have to reserve some brain cells to hold this info in case I ever do have a need.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 05, 2015 Jan 05, 2015

Copy link to clipboard

Copied

I don't see anything obviously wrong in your code. In my experience, I never see the "before cflocation" or "after cflocation" output and instead only see the 302 redirect header sent to the browser. First do a view source of your page. See if there is a <cflocation...> tag. If so, something is misspelled or you have some high bit characters mixed in. Next I would make a simple page1.cfm the uses cflocation to redirect to page2.cfm. If that fails, I would look at my webserver/cfserver settings. If the page1->page2 test succeeds, then I would simply the page to a straight cflocation call -- test -- add some code -- test -- repeat until it breaks. Good luck.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation