Lunarpages Web Hosting Forum

Author Topic: Why can not use <--#include file="XXX"--> in ASP program?  (Read 4735 times)

Offline lboyuan

  • Newbie
  • *
  • Posts: 4
Why can not use <--#include file="XXX"--> in ASP program?
« on: May 28, 2008, 06:53:01 AM »
I meet a very strange issue on Lunapage,I can not include a file in asp program,just like below simple code:
/////////////////SAMPLE BEGIN/////////////////////////////////////
<%@ Language=VBScript %>
<!--#include virtual="commonFunction.asp"--> <--if has this line,this page can not visite,if erase this line, this page works well !
<HTML>
<HEAD>
</HEAD>
<BODY>
<%
response.Write("Hello world!")
%>
</BODY>
</HTML>
/////////////////SAMPLE END/////////////////////////////////////
this page in /httpdocs
and commonFunction.asp in /httpdocs also.


This "hello world" program very simple,and could be ran on every asp hosting,but on Lunarpage can not visite,if open this page,will show:Internal Server Error

I ask the helpdesk of Lunarpage,but they said can not suport 3rd side softeware,include ASP programing problem,who can help me? what is the reason of this problem? and how can I resolve it?

Thanks!
« Last Edit: May 28, 2008, 07:18:40 AM by lboyuan »

Offline igolf2

  • Newbie
  • *
  • Posts: 5
Re: Why can not use <--#include file="XXX"--> in ASP program?
« Reply #1 on: June 28, 2008, 08:32:27 AM »
What happens if you write it this way? Looks like you are missing the exclamation mark (!) in the begining.



<!-- #include virtual="/XXX" -->

<!-- #include file="XXX" -->


Offline jj00

  • Newbie
  • *
  • Posts: 1
Re: Why can not use <--#include file="XXX"--> in ASP program?
« Reply #2 on: March 25, 2009, 10:07:50 AM »
Just wanted to make a quick note about includes in Classic ASP.  I nearly tore my hair out over this issue, so I thought I'd pass it along:

I couldn't get an include to work with double periods in it (".." or go up one directory).  For example:
<!-- #include file="../header.asp" -->

The solution was to set the server to allow scripts to use parent paths.  Specifically, "Allow to use parent paths" should be set under the Web Directory Preferences (I assume you are using the Plex control panel).

Hope this helps someone in the future.