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

include virtual

Status
Not open for further replies.

imadmarie

Programmer
Nov 14, 2001
14
JO
im trying to include virtual a file in my asp code, so far im not able to do it whithout specifying the name of the virtual directory

<!-- #include virtual=&quot;virtualdirectoy/file.asp&quot; -->

problem is i dont want to specify the name of the virtual directory in my code, cz this name might change when i change the IIS server, any help how i can include virtual a file without writting the name of my virtual directory ?
 
The idea behind a virtual path is that it is a path from the webserver's point of view. To include it virtually without having to specify the directory you will have to make that directory (and any subsequent directories the file lives in) a web share from IIS.
You could specify the file in relatibe terms if it is in the same directory that the head file (the one that is including it) is in. Just use:
Code:
<!--#INCLUDE FILE=&quot;file.asp&quot; -->
Or if the file is in a directory higher use a relative path like:
Code:
<!--#INCLUDE FILE=&quot;../file.asp&quot; -->[code]
Your only options for including are virtual paths(from the webfolder as root), absolute paths (from a drive letter,eg C:), relative absolute paths (a path to the file from the directory your head file is in). If there is another I am unaware of it (which is possible :b ).
-Tarwn ------------ My Little Dictionary ---------
Extreme Programming - (1)Trying to code before my second cup of coffee. (2) While(1){ Ctrl+C; Ctrl+V; }
FAQ - Web-ese for &quot;Forget Asking Questions, I am to busy&quot; :P
 
yes, 3 kinds, what im intrested in is the virtual path, but i dont want to code the directory virtual name
 
The only way to that is to either place the file in the top level of your website. A virtual path just means that it references the file as a browser would. So the only way you would not need to specify a directory name is if the file is at the top level of your site. For instance, in the folder.
-Tarwn ------------ My Little Dictionary ---------
Extreme Programming - (1)Trying to code before my second cup of coffee. (2) While(1){ Ctrl+C; Ctrl+V; }
FAQ - Web-ese for &quot;Forget Asking Questions, I am to busy&quot; :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top