?
Solved

How does ColdFusion resolve filenames? (stupid question???)

Posted on 2006-03-20
6
Medium Priority
?
276 Views
Last Modified: 2013-12-24
Bear with me, I'm new at this (but an experienced programmer).

In the code for a page named send.cfm there is this line:
<cflocation url="view.cfm">
It specifies where to go after inserting a record into a database (if this looks familiar, yes, it's from the tutorial that comes with DreamWeaver).

On my site, the files send.cfm and view.cfm reside in the same subdirectory on the site.
(To be exact, for my test server, they are in c:\CFusionMX7\wwwroot\MyTestSite\contact\coldfusion)

Now instead of going to the view.cfm page after inserting a record, I want to go to another page, named thankyou.html. That file is in the root folder for my site, specifically, it is in c:\CFusionMX7\wwwroot\MyTestSite

I cannot for the life of me figure out how to get it to find the file!
I have tried:
<cflocation url="thankyou.html">  (which I didn't think you work anyways, and it didn't)
<cflocation url="/thankyou.html">
<cflocation url="//thankyou.html">
<cflocation url="#thankyou.html">   (by now I am grasping at straws!)
<cflocation url=".thankyou.html">  

If I open a browser window and type in this address:
http://localhost:8500/CafeAlicia_1/thankyou.html
I can get to it just fine.

I've tried finding the answer in the Getting Started manual for Dreamweaver and in the help but I'm coming up empty!

If I put the file in c:\CFusionMX7\wwwroot\MyTestSite\contact\coldfusion and use the statement <cflocation url="thankyou.html">  it all works fine, of course! But I don't want to put the file there!)

What the heck is the correct way to tell it to go back to the root to find this file?

Thanks.
0
Comment
Question by:alicia1234
  • 3
  • 2
6 Comments
 
LVL 15

Expert Comment

by:danrosenthal
ID: 16241935
Try this: <cflocation url="../thankyou.html">  
0
 

Author Comment

by:alicia1234
ID: 16242046
danrosenthal: thanks, but it didn't work. I even checked the code on my test server to be sure the change got up there. Here is exactly what's in the code on the test server (I copied and pasted here):

<cflocation url="../thankyou.html">

also tried ./thankyou.html and
.../thankyou.html

no dice.
0
 
LVL 15

Expert Comment

by:danrosenthal
ID: 16242390
I did some testing and there was some funky caching going on. Try changing the name of the page that contains the CFLOCATION and see if that works (not thankyou.html). I tested the code I posted and you re-posted and verified that it works just fine.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:alicia1234
ID: 16243420
I made a copy of the page send.cfm ... the one that contains the CFLOCATION command.
Then I previewed it in browser ... I still get the file not found thing when it tries to access "../thankyou.html"
I did verify that my stest server does have "../thankyou.html"
0
 

Author Comment

by:alicia1234
ID: 16243699
Based on your comments, I tried some more things. In the process, I stumbled upon the user interface to change this parameter ... through Applications panel, Server Behaviors ... I double-clicked the item "Insert Record (form1, connAlicia, COMMENTS)" and got to the screen where I could browse for the "After inserting, go to" location.
I browsed to my thankyou.html file, and Dreamweave resolved it as "../../thankyou.html".
So I cancelled out and then went in to edit the code for the page to change the statement to
<cflocation url="../../thankyou.html">
I did a Preview in Browser and it asked about uploading files and I said to do it.
I still got the file not found error.
BUT ... then I went to the Files panel and did a "Put File(s)" from there.
Then it all worked fine.
So there does indeed seem to be some funny caching stuff going on.
WEIRD!
However ... it does turn out that the syntax with ../../thankyou.html was the correct one.
Can you explain why?

0
 
LVL 10

Accepted Solution

by:
Mr_Nil earned 500 total points
ID: 16244809
Alica,

<cflocation ...> uses absolute and relative URLs rather than physical paths.

If your page with the cflocation in it is at /CafeAlica_1/contact/coldfusion and the page you want to location to is in /CafeAlica_1 then you either need to go back up 2 folder levels eg ../../  or you need to use /CafeAlica_1, so that it know to redirect to a page in the virtual directory "CafeAlica_1" at the top level of the site.

<cflocation url="thankyou.html">  would look in the same folder as the calling template
<cflocation url="/thankyou.html"> would look in the very top level of the site get http://localhost:8500/
<cflocation url="//thankyou.html"> is invalid, but would probably still look in the top level of the site.
<cflocation url="#thankyou.html"> would try to go to an anchor called "thankyou.html" in the current page (maybe)
<cflocation url=".thankyou.html">  would look for a file call ".thankyou.html" in the current folder
<cflocation url="../thankyou.html"> would look in the folder above the calling template.
<cflocation url="../../thankyou.html"> looks two folders above the calling template
<cflocation url="/CafeAlica_1/thankyou.html"> is an absolute path to the template thankyou.html

Hope this helps

Stephen
 
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
What You Need to Know when Searching for a Webhost Provider
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…
Suggested Courses
Course of the Month14 days, 23 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question