Character is not valid

We use 2 master pages for a very large solution.  Recently, we added a project to this solution.  We also updated the code behind of the master pages (with an updated service call).  At some point, we gained some errors on the master page which do not allow me to compile the project housing the master pages.  Here are the errors:

Error      173      Character is not valid.      C:\projects\MSC\MSC_MasterPage_NotLoggedIn.Master      1      2      MSC

Error      174      Identifier expected.      C:\projects\MSC\MSC_MasterPage_NotLoggedIn.Master      3      2      MSC


Attached is the code for one of the master page.  The code behind is very basic.  If I un-comment out the doctype and html lines, the errors swell to 37 (from 2).  The new errors include beauties like '>' expected on line 6 column 7 (the end of <html> before the xmlns) and 'Attribute specifier is not a complete statement.  Use a line continuation to apply the attribute to the following statement'. line 7 column 12 which is the start of the Title text.  

This is driving me nuts!  Any help would be greatly appreciated!!
<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="MSC_MasterPage_NotLoggedIn.master.vb" Inherits="HFMA_MSC.MSC_MasterPage_NotLoggedIn" %>

<!-- <!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 runat="server">
    <title>Untitled Page</title>   
    
<%--<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-5781097-1");
pageTracker._trackPageview();
</script>--%>

</head>


<body>

    <%--display framework from web service--%>
    <% =strHeader%>
    
    <form id="form1" runat="server">
    <div>
        
        
          
    <table width="100%" cellpadding="0"  cellspacing="0">
    
        <asp:ContentPlaceHolder ID="SiteNameRow" runat="server">
        <tr>
            <!-- cell to display site name from web.config if = <add key="TEST_SWITCH" value="TEST" />     -->
            <td align="center" valign="top" style="width:100%" ><br /><b><asp:Literal ID="ltl_SiteName" runat="server" Visible="true"></asp:Literal></b><br /><br />
            </td>
        </tr>
        </asp:ContentPlaceHolder>
    
        
     </table>
   
    
    
    
    
        <asp:contentplaceholder id="cph_MainPageContent" runat="server">
        
        <table  width="90%" border="0" cellpadding="2" cellspacing="0"  >
    
        
        
        </table>
       
        </asp:contentplaceholder>
        
        
        
    </div>
    </form>
    <% =strFooter%>
</body>
</html>

Open in new window

jkerwinAsked:
Who is Participating?
 
jkerwinConnect With a Mentor Author Commented:
The code appears to compile.  My first problem of the page showing all the errors was solved by placing the page in content mode.  My second problem was related to our test environment so I'm going to close this without awarding points.
0
 
robastaCommented:
You commented out the <html> tag, i.e.

<!-- <!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" > --!>

remove the comments or at least just comment out the doctype declaration.

0
 
jkerwinAuthor Commented:
Yes, that HTML was commented out but un-commenting it out only increased the number of errors.  I looked at our old server where this project was located.  It turns out that the master pages are set to be included as content, not compiled.  On the old server, if I set them to compile, all those same errors show up.

So the answer to my question is: don't put your master page into compile mode.  However, my follow up question (as my problem is not sorted out), does the Master page CODE actually compile if the master page is in Content mode?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.