Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFServer generates its own Header!!!

Status
Not open for further replies.

i2k2

Programmer
Nov 9, 2002
5
0
0
AE
Hi all,
I have this wierd peoblem. I write my own header information at the top of each CFM page, but when I run the page CFServer generates its own Header before the one I set!!

Here is what I write:
====================
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<body>
</body>
</html>
<html>
<title>Search</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=1256&quot;>
<body dir=&quot;rtl&quot; lang=&quot;ar&quot;>
</body>
</html>
====================

And Here is what I get when the page runs:
====================
<html>
<title>Search</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=1256&quot;>
<body dir=&quot;rtl&quot; lang=&quot;ar&quot;>
</body>
</html>
====================

Help please --------
i2k2
 
It seems you may have written this backwards... (?) You said the CFServer is generating its own header, but it looks from your example like the CFServer is deleting code, not adding it. I'm going to go on the assumption that the second thing is what the file says, and the first thing is what you see when you request the page. If I'm wrong, please correct me and shame on me for doubting you [wink]

I had a similar problem once on one of my servers. It traced back to an errant Application.cfm page. As you may know, when a page is requested the CFServer looks for a page called Application.cfm in the same directory as the page that was requested. If it doesn't find it, it begins to step &quot;up&quot; the directory structure looking for the file. It will continue to look even beyond the server's root folder, all the way to the root of the drive looking for an Application.cfm file. If it finds one, it inserts the code from that page into the page that was requested, at the top. It only uses the first Application.cfm page it finds and then stops looking.

It is my suspicion that you may have an Application.cfm page somewhere that is causing the extra code to be inserted into your page. One way to test that is to put an Application.cfm page in the same directory as the page you are requesting. There is a minimum of how much code must be on this page for the CFServer to use it as the Application.cfm page, but a few ColdFusion comments should probably do the trick. If the &quot;mystery code&quot; is gone when you request the page after adding the Application.cfm page, you know that this was the problem; then you'll have to search the filesystem for the errant Application.cfm page.

Since I feel that the CFServer searching above the document root of the web server is a security issue, I always put an Application.cfm page with a couple of ColdFusion comments in the document root of the web server. This ensures that any time the CFServer searches for an Application.cfm page, it will look no higher than the document root.
 

Ummm... this is pretty much what I would expect to happen with the example you provided.

Code:
<meta http-equiv=&quot;Content-Type&quot; ...>

is meant to define what is equivilent to a MIME type and a character set for a given document.

You have two documents defined in a single HTML page (which, I believe is illegal according to W3C specifications... but regardless). The browser has essentially chosen the one that matches it's default MIME type/character set (since it exists) and has discarded the other.

I'm not quite sure why you're defining two documents in a single page (in SMTP, it's specifically to benefit from the behavior you're considering to be a &quot;problem&quot;, here... to be able to send HTML email to clients that understand it and ASCII text email to those that don't... but, as I said, I believe it's illegal in HTML). Could you fill us in?

Hope it helps,
-Carl
 
carl, I think i2k2 may have labeled the excerpts backwards. He (she?) said &quot;when I run the page CFServer generates its own Header before the one I set&quot;, so I think that the first excerpt is what actually comes from the server, whereas the second excerpt is what is in the file.

i2k2, can you confirm?
 

If that's true, that the excerpts are mislabeled, I'm with you, pcorreia... it sounds like an Application.cfm stuck somewhere it isn't expected.

One other thing I might check is make sure the HTML is properly defined:

Code:
<html>
<title>Search</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=1256&quot;>
<body dir=&quot;rtl&quot; lang=&quot;ar&quot;>
</body>
</html>

should be
Code:
<html>
Code:
<HEAD>
Code:
<title>Search</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=1256&quot;>
Code:
</HEAD>
Code:
<body dir=&quot;rtl&quot; lang=&quot;ar&quot;>
</body>
</html>

can't imagine... but it's possible (especially since you're implicitly defining a HTTP-EQUIV) that the server or the browser is making the code a well-structured document the only way it knows how... adding it's own <html>,<head>,and <body> tags (complete with it's own default HTTP-EQUIV).

Hope it helps,
-Carl
 
pcorreia, you are a real smart ;) the problem is solved and as you assumed I wrote the code backwords. you really helped.

thank you everybody :) --------
i2k2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top