• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

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

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
alicia1234
Asked:
alicia1234
  • 3
  • 2
1 Solution
 
danrosenthalCommented:
Try this: <cflocation url="../thankyou.html">  
0
 
alicia1234Author Commented:
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
 
danrosenthalCommented:
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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
alicia1234Author Commented:
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
 
alicia1234Author Commented:
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
 
Mr_NilCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now