none
VS 2008/C# 3.5 Web App/IIS 7/Vista -- #include virtual=../includes/ssi/header.html -- not working? RRS feed

  • Question

  •  

    Hey, I've got the oddest problem and just can't seem to understand why it's not working? Ok, I've got a page, index.html, that has a few includes for the navigation, header and footer. The directories exisit and there are files in there. I don't know if it's a configuration issue, or if I've lost my mind? Here's the html:

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title></title>

    <link rel="stylesheet" type="text/css" href="../includes/css/global.css">

    <link rel="stylesheet" type="text/css" href="../includes/css/explore.css">

    </head>

    <body>

    <div id="page_container">

    <!--#include virtual="../includes/ssi/header.html" -->

    <div><img src="../media/images/explore/landing_header.jpg" width="997" height="164" border="0" /></div>

    <div id="secondary_content">

    <div class="left">

    <!--#include virtual="../includes/ssi/left_nav_explore.html" -->

    </div>

    <div class="center">

    <h5><a href="/explore/index.html" title="EXPLORE">EXPLORE</a></h5>

    <div class="page_header_img"><img src="../media/images/explore/landing_header_img.jpg" width="556" height="304" border="0" /></div>

    </div>

    <div class="right">

    </div>

    </div>

    <!--#include virtual="../includes/ssi/footer.html" -->

    </div>

    </body>

    </html>

     

    Why are my includes not working?

    Friday, April 11, 2008 9:21 PM

Answers

  • I am sorry for the confusion above.

     

    I am no IIS expert so I may not be the best to point what is wrong but just tried the below:

     

    Created testInclude.html with the following content:

    <html><head><title>Test Include</title></head>
    <body>
    <p>I am from original testInclude file</p>
    <!--#include virtual="/includes/include.html" -->
    </body></html>

     

    This did not seem to load the include and treated it as comments (no errors thrown either).

     

    Then I created the same with .asp and it loaded the include correctly (note: ../includes does not seem to work -> I had to use /includes).

     

    So I am thinking it is with the extension. You may try .asp.

     

    You may also want to post this question to http://forums.iis.net/ to catch the right audience for your question. This forum is mainly for .Net Framework setup related issues so may not be as appropriate.

     

    Sunday, April 13, 2008 5:38 PM
    Moderator

All replies

  • Vista (and Windows 2008) editions of IIS have basically everything disabled by default.  You'll need to go into IIS and enable ASP/ASP.NET/Server Side Includes or whatever it is that you're using.

    -Ryan / Kardax
    Saturday, April 12, 2008 12:38 AM
  • Hey Ryan / Kardax,

       Thanks for the quick reply. I had ASP.NET and Server Side Includes, I just enabled ASP, and still no luck. I tried running it in the VS 2008 Dev Enviroment, and IIS 7, both didn't render the include files. All the HTML is right, the includes are just .html files? It's not like they're .shtml/.shtm files? (Tried changing file type, didn't work) I'm open to any ideas!

       I *think* it's something in the Setup? Everything I've read leads me to believe that includes still work, so I must have something setup wrong?

    Thanks for the help!

    John.

    Saturday, April 12, 2008 3:41 AM
  • Oh, I forgot to mention, the images are rendered and the .css rules are being applied. Not sure if that helps anyone?

    Thanks,

    John.

     

    Saturday, April 12, 2008 1:33 PM
  • You might want to refer to this thread: http://www.webmasterworld.com/html/3305986.htm

     

    I did not see the mention of following these steps in your post so I am thinking this may be missing:

     

    To parse ordinary html for includes, no alternate language is required, no fiddling with extensions, and your URL's can remain the same. Locate the file httpd.conf on your server. Within that file you should find the addType directive for SSI's:

    AddType text/x-server-parsed-html .shtml

    You can alter this line to parse all html

    AddType text/x-server-parsed-html .shtml .html .htm

    or simply add another line

    AddType text/x-server-parsed-html .html

    then restart httpd

    /etc/rc.d/init.d/httpd restart

    And you're good to go.

    http://hoohoo.ncsa.uiuc.edu/docs/tutorials/includes.html

     

    Hope this helps.

     

    Thanks,

    Kanchan

    Saturday, April 12, 2008 3:17 PM
    Moderator
  • Hey Kanchen, thanks for the reply! If I were on Apache, that would be the solution. Oddly enough this app is getting ported off Apache to IIS 6. My project compiles fine and runs. All of the graphics show up (they're in the folder next door) and the style sheets are being processed, just not the includes? So I seriously doubt it's a security / access problem. I'm sure includes have to be supported in IIS, is it something I'm not putting in the HTML? I don't think so? Is the problem the .html extesion? Maybe since it's html the server doesn't process it?

     

    I mean all I'm trying to do is stick in a <div>Stuff goes here</div> at those locations.

     

    Thanks!

    John.

    Saturday, April 12, 2008 4:33 PM
  • I am sorry for the confusion above.

     

    I am no IIS expert so I may not be the best to point what is wrong but just tried the below:

     

    Created testInclude.html with the following content:

    <html><head><title>Test Include</title></head>
    <body>
    <p>I am from original testInclude file</p>
    <!--#include virtual="/includes/include.html" -->
    </body></html>

     

    This did not seem to load the include and treated it as comments (no errors thrown either).

     

    Then I created the same with .asp and it loaded the include correctly (note: ../includes does not seem to work -> I had to use /includes).

     

    So I am thinking it is with the extension. You may try .asp.

     

    You may also want to post this question to http://forums.iis.net/ to catch the right audience for your question. This forum is mainly for .Net Framework setup related issues so may not be as appropriate.

     

    Sunday, April 13, 2008 5:38 PM
    Moderator