How does #Include virtual work?

Z

Zenobia

I copy an application to wwwroot:

wwwroot
+--- myApp
+--- common
|
+--- images
|
default.asp
global.asa

I create a virtual directory to point to it. To do that I open
IIS plugin, Navigate to "Default Web Site", right context menu,
New, Virtual Directory, Next, Alias = "myApp", Next, Directory =
"C:\Inetpub\wwwroot\myApp", Next, Next, Finish.

At the top of default.asp is the line:

<!--#Include virtual="/common/setupadrot.asp" -->

But I get an error.

Active Server Pages, ASP 0126 (0x80004005)
The include file '/common/setupadrot.asp' was not found.
/myApp/Default.asp, line 6

What is the correct way to use #Include virtual with a web
directory set up like this? Where does the app think the root
is and how can I find out where it thinks the application's
web-root is located.

None of these work.
<!--#Include virtual="common/setupadrot.asp" -->
<!--#Include virtual="/common/setupadrot.asp" -->
<!--#Include virtual="./common/setupadrot.asp" -->
<!--#Include virtual="../common/setupadrot.asp" -->
<!--#Include virtual="/../common/setupadrot.asp" -->

This will work OK:
<!--#Include virtual="myApp/common/setupadrot.asp" -->

but the problem is I don't want to include the name of the root,
"myApp", because this may change at some time in the future.

Will I have to use
<!--#Include virtual="myApp/common/setupadrot.asp" -->
during development and change it to:
<!--#Include virtual="/common/setupadrot.asp" -->
when I deploy it?

Naturally I need to have several distinct web applications in
wwwroot. Using #Include file is out of the question.
 
M

Mark

why dont you just make a virtual directory that is common then you can point
it wherever you want and wont have to recode?
 
L

Larry Bud

Will I have to use
<!--#Include virtual="myApp/common/setupadrot.asp" -->
during development and change it to:
<!--#Include virtual="/common/setupadrot.asp" -->
when I deploy it?

Naturally I need to have several distinct web applications in
wwwroot. Using #Include file is out of the question.

If common is inside myApp, then the first way is the only way to do it.

Just put common under the root of your website instead of inside your app folder.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top