Use include virtual in a subdomain

Posted on 2006-07-06
Last Modified: 2013-11-18
Is it possible to use include virtual in a subdomain and include a file from the root?
Question by:AndreasA
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1

Expert Comment

ID: 17050404
I'm assuming you're asking if you can use something like:

<!-- #Include virtual="" -->

In a file on a website host like:


If so, the answer is no, you can't include a file outside of your own site using the above method. If the file contains only HTML, there are other ways to embed it into your page but if the file contains code such as functions that you need to access, you will need to re-create those functions within another file in your own site.
LVL 25

Accepted Solution

kevp75 earned 500 total points
ID: 17050833
unfortunatley Dragon, using an http:// in a virtual include will never work, it would be a huge security risk to sites every where if it did.

it is along those same lines however....<!--#include virtual="/includesFolder/includeFile.ext"-->    will insure the page starts in the applications root folder, then goes to includesFolder.

What you have to do is make sure that it is a true subdomain (ie....make sure the subdomains headers are correct, and it is a seperate site)

to use an include from the domains root (not the subdomains root), you could use  <!--#include file="../rootIncludes/includefile.ext"-->

Expert Comment

ID: 17050958
Yeah kev, I know it's a security risk and that it can't be done, which is why I said the answer is no in my initial response.

I was just using the line above to clarify if this what what AndreasA was actually asking cos it's fairly well known that you can't use the Include option to embed files from another domain, sub-domain or website etc.

However, I didn't want to dishearten AndreasA by simply saying, No, no, no... Hence I added the bit about how to get around it depending on the content of the SSI file they wanted to embed ;-)
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

LVL 14

Expert Comment

ID: 17054047
No you can't.

However you could, say perhaps map a virtual disk to the computer and folder where this asp file is and then creating a virtual directory in IIS?

Author Comment

ID: 17056779
thanks for the comments. is is not even possible some how when it is on a subdomain? on the same server?
LVL 14

Expert Comment

ID: 17059220
If it's on the same server why don't you just create a virtual directory for the directory that contains the asp files you need?

Author Comment

ID: 17064458
Included the file using "<!--#include file="../www/site/inc/"-->" where "www" is the root domain. Works fine.

Thanks for your help and comments.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Make Line Items Look Good Over Mobile 2 126
Grunt script for Build Process 1 90
GitHub 1 40
how can i find the index of all downloads for a site 3 14
There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question