Did you just make an edit to a page on your templated website and nearly faint when you saw the end result?

A strange header display in Internet Explorer is a tell-tale sign of Expression Web inserting unnecessary code into your page’s header. The good news is that it’s a quick and easy fix.

  1. Open the HTML code using a text editor.
  2. Delete the extra garbage (shown in red below) Expression Web just inserted at the top of your file.

Voila! Back to normal.

BAD:

<%@ CODEPAGE=65001 %>
<!– #include virtual=”/[your-directory-name]/template/data.asp” –>
<head>
<style type=”text/css”>
.auto-style1 {
text-decoration: underline;
}
</style>
</head>
<%
pageTitle = “Program Overview” ‘Title used in title tag …

View screenshot of bad code.

GOOD:

<%@ CODEPAGE=65001 %>
<!– #include virtual=”/[your-directory-name]/template/data.asp” –>
<%
pageTitle = “Program Overview” ‘Title used in title tag …

View screenshot of good code.

Why does this happen?

We think this happens because Microsoft Expression Web wants a <head> in the HTML file. It doesn’t “know” that the template code is pulling an include file which contains the page’s <head>, so it makes one itself. To make this even more strange, Expression Web doesn’t do this every time you save. Only when it feels like it.