#1
  1. No Profile Picture
    ZLA
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jun 2004
    Posts
    44
    Rep Power
    11

    How to configure website to use INCLUDE VIRTUAL


    I maintain a client's website which is hosted by another company. The website is written in ASP. I develop changes to the website locally on my Windows XP Pro computer running IIS 5.1.

    There are a few places in the app where server side include files are used. Unfortunately, I have to use INCLUDE VIRTUAL for the production site and INCLUDE FILE when developing locally. Here are the two versions:

    Code:
    <!-- I use the following in DEV -->
    <!-- #INCLUDE FILE="../include/ObjDef.inc" -->
    
    <!-- I use the following in PROD -->
    <!-- #INCLUDE VIRTUAL="/include/ObjDef.inc" -->
    This means I have to remember to change the server side include statements before I upload changes to these files.

    Can anyone tell me how I can configure my local machine to work with the INCLUDE VIRTUAL directive?

    I saw a separate post that said "IIS wont let you call "Includes virtual" from any virtual directory that is not on the root." I have checked IIS and the path for my local copy of the website is listed as c:\inetpub\wwwroot\MySite. Is this incorrect?

    Thank you in advance.
  2. #2
  3. Web-Standards Evangelist
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Nov 2003
    Posts
    1,522
    Rep Power
    14
    Is "MySite" listed as an Application in IIS? If so, then include virtual will work because it has its own application scope and root.
  4. #3
  5. No Profile Picture
    ZLA
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jun 2004
    Posts
    44
    Rep Power
    11
    In IIS, MySite properties list "MySite" as the Application Name with a starting point of
    Code:
    <Default Web Site>\MySite
    Is this correct? Should I try removing and adding back the application name?

    By the way, the error information I get is as follows:

    HTTP 500.100

    Error Type:
    Active Server Pages, ASP 0126 (0x80004005)
    The include file '/include/ObjDef.inc' was not found.
    /mywebsite/admin/mypage.asp, line 24


    Browser Type:
    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)

    Page:
    GET /mywebsite/admin/mypage.asp

    Thanks.
  6. #4
  7. No Profile Picture
    Grumpier Old Moderator
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2003
    Posts
    10,143
    Rep Power
    187
    If you're using a workstation version of windows (XP or whatever) you are restricted to a single website, so if you're using the box for development you can't duplicate the web structure of your target server. Each of your development websites will probably be virtual directories under your root web and when you transfer to the web server you'll probably run across many broken links and includes.

    Easiest would be to use a server OS for development.
    ======
    Doug G
    ======
    I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain
  8. #5
  9. No Profile Picture
    ZLA
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jun 2004
    Posts
    44
    Rep Power
    11
    You are correct; I am using XP Pro and my dev sites are all virtual directories under the root.

    Since I only need to work with one web site at a time, is there any way to configure things so that the #Include virtual statement will work for a single dev site? For example, can I point the default web site's home directory (normally, c:\inetpub\wwwroot) to my dev site (say, c:\inetpub\wwwroot\MyDevSite)?

    What are the consequences of such action?

    Thank you in advance.
  10. #6
  11. No Profile Picture
    Grumpier Old Moderator
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2003
    Posts
    10,143
    Rep Power
    187
    Include virtual will always go from the root web of the website, so unfortunately you must specify the additional virtual directory in the include virtual url.

    There is no simple workaround I know, other than use a server OS that supports multiple websites.
  12. #7
  13. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    May 2005
    Posts
    70
    Rep Power
    10
    Just a suggestion, why don't you just use INCLUDE FILE on your server? As long as all the directories are the same, it would work the same. Unless your host doesn't allow INCLUDE FILE for some odd reason(I'm not that good with this stuff, but I know enough for the likes of me )
  14. #8
  15. No Profile Picture
    Grumpier Old Moderator
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2003
    Posts
    10,143
    Rep Power
    187
    It really doesn't matter if you use include file or include virtual if you're working on a non-server IIS that only allows a single website. You still have to deal with that pesky virtual directory folder (unless you put your includes outside the web and your host allows parent paths).
  16. #9
  17. No Profile Picture
    ZLA
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jun 2004
    Posts
    44
    Rep Power
    11
    When I've used Include File on the hosted production site, it doesn't work.

    I am able to use Include Virtual on my dev server (XP Pro with IIS 5.1) as long as I set the default web site's home directory (normally, c:\inetpub\wwwroot) to my dev site (say, c:\inetpub\wwwroot\MyDevSite). This allows me to make a simple config change to my local IIS instead of changing all the source files that have the errant include statements.

    Thanks for everyone's suggestions.

Similar Threads

  1. #include VIRTUAL ="/inc/.." problem in IIS 5
    By lisasspa in forum Microsoft IIS
    Replies: 1
    Last Post: December 2nd, 2004, 05:49 PM
  2. Mass email problem: Text is Looping!
    By niclipse in forum Microsoft SQL Server
    Replies: 1
    Last Post: November 4th, 2004, 04:37 PM
  3. Include Virtual ="../" Problem
    By Wackedout79 in forum Microsoft IIS
    Replies: 1
    Last Post: January 29th, 2004, 01:51 PM
  4. How to include a html file from other website
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: December 19th, 2001, 05:37 PM
  5. Virtual Include Files
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: August 29th, 2000, 02:50 AM

IMN logo majestic logo threadwatch logo seochat tools logo