DiogoNeves
DiogoNeves

Reputation: 1777

VS 2005 fails to build aspx files with includes

I'm new to the ASP development. The project I'm working on has most of the repeated header asp code in an .inc file, something along the lines of:

<!--#include virtual="header.inc"-->
<body><!-- body is closed in footer.inc -->

<!-- ... -->

<!--#include virtual="footer.inc"-->

When building, VS is reporting quite a lot of errors like:

Error 310 Validation (XHTML 1.1): Element 'body' is missing its closing tag. ------page_name------ 13

I thought the includes were included before validating the page thus adding the appropriate closing tag. Does anyone have any idea why this would happen? Am I missing any configuration?

Thanks

Upvotes: 0

Views: 120

Answers (1)

Khan
Khan

Reputation: 18172

Server Side Includes are supported by IIS(so they can be used!) but .NET is not involved with this include at all. So the header and footer are going to be added too late in the game.

Go here for more info: http://www.dotnetperls.com/ssi

Look into MasterPages if you're trying to avoid duplicating XHTML. This is perfect for headers and footers.

Also I suspect that you're going to need to know that elements will need to contain "runat" and "Id" attributes in order to be used in asp.net/referenced in the code behind.

Upvotes: 1

Related Questions