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

ASP Sub problem: My Sub is in a different asp page can't be called

Status
Not open for further replies.

T1M

Programmer
Jul 3, 2001
14
CA
I have a few Subs in one file that do things like write the headers and footers of my page. I want to separate them from my code so I have put them in another page (inc_html.asp). I get an error when I try to use:
<%
server.execute &quot;inc_html.asp&quot;
Call WriteHeader
%>
I am here.
<%
Call WriteFooter
%>

Server.Execute works and when I cut and paste the code for the sub into this page, it works and I can write the header and footer. Any suggestions?

T1m
 
put this at the beginning of your .asp script

<!--#include file=&quot;inc_html.asp&quot;-->
 
Your suggestion worked. Any idea why it didn't work as Server.Execute and <!--#include file=&quot;inc_html.asp&quot;--> was fine?

T1m
 
is your subroutine within the inc_html.asp file? and if so, did you call your subroutine immediately upon entering the inc_html.asp file? if not, then it will only process code that is not part of a sub or function.

example:

inc_html.asp file

<%
call mysub

sub mysub
do this
do that
do some more
end sub
%>

that should work, but if you didn't have the call mysub line, then it's just a sub waiting to be called.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top