Virtual include not working

为君一笑 提交于 2019-12-13 06:27:35

问题


I have recently taken over a website written in Classic ASP which i had no previous experience with.

In the root of the site the default.asp has an include:

#include virtual="/inc/common.asp"

However when hosted on the web server or locally (IIS) it returns with an error which says the include file 'common.asp' could not be found. The inc folder exists in the same directory as the default.asp and the common.asp is in the inc folder.

Any help would be appreciated!


回答1:


You say that the inc folder is in the same folder as default.asp - however you don't say if this folder is root. #include virtual takes a path from root, so ensure that you have the full path in there.

There's a quick explanation of #include syntax here: http://www.w3schools.com/asp/asp_incfiles.asp




回答2:


You cannot start an include link in Classic ASP with a slash (/). So your include needs to be like:

#include file="inc/common.asp"

or #include file="../inc/common.asp" or include file="../../inc/common.asp"

Notice that I used "file" instead of "virtual"?

<!--#include file="inc/common.asp" -->

Also, unless your include is within the same folder, you will need to enable "parent paths" in IIS admin.



来源:https://stackoverflow.com/questions/16106820/virtual-include-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!