Link to home
Start Free TrialLog in
Avatar of alicia1234
alicia1234Flag for United States of America

asked on

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.
Avatar of danrosenthal
danrosenthal

Try this: <cflocation url="../thankyou.html">  
Avatar of alicia1234

ASKER

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.
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.
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"
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?

ASKER CERTIFIED SOLUTION
Avatar of Mr_Nil
Mr_Nil
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial