I'm trying to understand ASP but #include doesn't seem to work for some reason. I'm using IIS 7.5 (included with Win 7).
I have two .asp files in .../wwwroot/MyWeb/. I'm trying to #include FiboRecursive.asp in a file called test.asp. Both files work separately if I remove the #include. I have tried both virtual and file includes.
This is test.asp:
<%@ language="javascript" %>
<html>
<body>
<p>
<% //Response.Write(Request.ServerVariables("http_user_agent"));%>
</p>
<p>
<%
var remoteAddr = Request.ServerVariables("REMOTE_ADDR");
remoteAddr += "";
if ((remoteAddr.length > 5) && (remoteAddr.substr(0,7)=="140.114") ) {
Response.Write("Hello there Tsingda student!");
}
else {
Response.Write("You're not a Tsingda student!");
}
%>
</p>
<form action="./FiboRecursive.asp" method="post">
<input type="submit" value="Calculate Fibonacci numbers!" />
</form>
<!--#INCLUDE FILE="fiborecursive.asp" -->
</body>
</html>
This is the code in FiboRecursive.asp:
<%@ language="javascript" %>
<%
Response.Write("Let's calculate some Fibonacci numbers!");
%>
Edit: Another thing: I always use web developer tools (error console) in Firefox to check for errors in my code, but obviously that doesn't work too well when doing server side stuff. Any way to get some hints as to what's wrong from a console or similar?
You should not have the @ command within your include file as this will (in ISS version 5.1 at least) result in the following error:
Error Type:
Active Server Pages, ASP 0141 (0x80004005)
The @ command can only be used once within the Active Server Page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With