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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Include file not including 1

Status
Not open for further replies.

Vjer

Technical User
May 7, 2004
11
US
I'm trying to use include files for "static" portion of asp pages on a site. I've read numerous examples on this site and others and thought I had the code right, BUT ... when I try to run the pages on the web server I either get a page with two vertical lines where my header logo should be and nothing where footer should be OR the actual script shows on the page! Code for test page is below. Can someone tell me what I'm missing!

--- main file as homepage.asp ---
<!-- #include file=include/pgtop.asp"
<!-- #include file="header_menu.asp" -->
<br /> and then there's the call to the menu by script below... <br />

<script src="xaramenu.js"></script><script Webstyle4 src="buttons/top.js"></script>
</body></html>

------ pgtop.asp code ----------
<%@ Language=vbscript %>
<% option explicit %>
<html>
<head>
<title>THE AGSBA PAGE TOP</title>
</head>
<body bgcolor="#527F76" text="white">

--------- header_menu.asp --------
<img border="0" src="images/Logo.jpg" width="800" height="134"><br />

<!--webbot CLIENTSIDE
bot="Ws4FpEx" MODULEID="'Default (Project)\top_off.xws'" PREVIEW="<img src='buttons/top.gif?04E903C3' editor='Webstyle4' border='0'>" startspan -->
<script src="xaramenu.js"></script><script Webstyle4 src="buttons/top.js"></script><noscript><img src="buttons/top.gif?04E903C3" editor="Webstyle4" width=800></noscript><!--webbot
bot="Ws4FpEx" endspan i-checksum="50323" -->

--------------------------------------------------------
When the test file is loaded, I thought it would show the page with the logo (logo.jpg) and the menu bar under it, the line of text and another menu bar from the direct reference to the code. However, the only thing on the page is the text line and the second menu bar.

I have verified that the asp files are in the proper folder, BTW.


 
[tt]
<!-- #include file=include/pgtop.asp"[red]-->[/red]
<!-- #include file="header_menu.asp" -->
[/tt]

Is this it?
 
You also appear to be missing the opening quotes:

[tt]<!-- #include file="include/pgtop.asp"-->[/tt]

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
When you say "is this it?" are you asking if that is all the includes? Yes. And the code is ACTUALLY:

<!-- #include file="include/pgtop.asp"-->
<!-- #include file="header_menu.asp" -->

I accidentally deleted the first quote for pgtop.asp reference....

 
Alright when you load the file in your browser what do you see in the address bar?

Is it something like this:
Or is it more like: C:\Inetpub\
Because if it is the latter then the server is not running any of the the script.. the browser is just loading from the file.

Sometimes it helps if you right-click in your browser and choose "View Source" ... this will show you the output from your ASP.
 
I'm sorry, Drive a Steam Roller, but I've checked the FAQ you refrrenced and don't see what I did wrong? Was there something specific you wanted to tell me about? I'm not trying to be dense, I'm afraid it's a natural condition <g>.
 
With the two corrections (the opening " and closing -->) the code should run fine. Does it still crap out with the corrected code?

If so, are you sure you have the relative paths correctly listed? Personally, I use virtual directories, which allows me to avoid many of the path resolution problems. Once created, the virtual directory allows you to resolve the name using the VD name as the base.

Such as:

Without VD:

<!-- #include file="include/pgtop.asp" -->
OR
<!-- #include file="d:/Inetpub/ -->

With VD: --> where MySite is the name of the virtual directory.

<!-- #include virtual="/MySite/include/pgtop.asp" -->

Without the VD, you have to have either the absolute path, or a correctly formed relative path, which can become a bit cumbersome if you have a large number of directories. If you use alot of includes and a large directory structure, your reference path will change with every directory level.

With the VD, you just need the path down from the VD home directory. If you use alot of includes and a large directory structure, the path will remain constant through all directory levels.

This is probably way more than you were looking for, but it is handy info to know about includes. Well that, and I'm waiting to go home. ;)

GL
ryandoah
 
The address bar shows it loading on the host server not locally. When I view source, the code shows the reference to the include as represented by code below:
===== view source of homepage.asp (in entirety)
<!-- include file="include/pgtop.asp" -->
<!-- #include file ="header_menu.asp" --> <table border="0">
<tr><td>Something should show here...</td></tr>
</table>
</body>
</html>
====== end of source



 
Vjer,

That link to the FAQ on johnwm's post ... it is a normal part of his .sig file ... not directed specifically at your question.
 
Thanks, Ryandoah, for the notes. I've been bitten by the directory path before so I make sure my test, development, and production folders are the same under different master folders, i.e., \dev\web\include vs \test\web\include vs the web site \web\include. This keeps me out of trouble ... usually!

The missing quote and closing "-->" are in the actual code I'm running ... don't know why they fell off in the copy and paste I did?! You can see by the source code listed earlier it is seeing the proper include line, just not running it. Weird!
 
Looks like a missing #
[tt]
<!-- [red]#[/red]include file="include/pgtop.asp" -->
<!-- #include file ="header_menu.asp" -->
[/tt]

PS: Are you having any problem with plain ASP? Like if you make an ASP file that contains only one line: Today is: <%= Cstr(Now)%> ... does that work OK?
 
Sheco -- jeez - that was staring me right in the face. BUT - it did not change the displayed page!!!

If you go to


you can see how this page is displaying and see the source code.

And, thanks for pointing out my error on John's response. I was trying to make it TWO messages instead of the one it is. Time to go home! (but not just yet)
 
Well it looks like the ASP itself is not being processed at all!

Otherwise the web page wouldn't contain this in plain text:
[tt]
<%
dim strPage, strPgeDescription,tcolleft,tcenter,tright
stPage = "HomePage"
tcolleft = "homeleft.htm"
tcenter="homecenter.asp"
%>
[/tt]

Take a look at your IIS Admin tool and make sure the web app is Created and the execute permissions are not set to "None".
 
Did you just copy this site to a different server or upgrade the server OS fromm 2000 to 2003? It looks like IIS is not using the ASP engine at all.
 
Well, it's not a new site ... and it is a hosted site so I do not have access to the server or IIS. I can contact the host technical support line and see if they can check it out. It sure seemed like the asp was just being ignored but I wanted to be sure I hadn't missed something obvious (like the # at the start of the include directive <g>) before I went that route.

If anyone thinks of anything else, I'd appreciate your thoughts. I'll give them a call this evening and report back.

Thanks
 
Can you just make a one line ASP page like this:
[tt]The time is: <%= Cstr(Now)%>[/tt]

You know, just to test if the server is processing any ASP.




 
I created the file suggested above (named aspcheck.asp) on that same site. Guess what, it shows the line exactly as typed ... no interpretion of the asp at all. I'll check with tech support and see what's happening.

 
>I go to the page. A pop up of warning: "Some file can harm your computer. If the file information below (homepage.asp) look suspicious, or you do not fully trust the source, do not open or save the file."

Can the forum receive an explanation from the op?
 
Your web server has now been configured to not only not execute ASP pages, but to not include the right mime-type information, telling the browser that homepage.asp is a file to be downloaded.

It seems that your tech support has caused a different problem.
 
Yeah, it's just allowing anon users to DL the source. At this point, I'd say your code is not the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top