none
ASP Code Still Processed Within An HTML Comment Line RRS feed

  • Question

  •  The following comment in an ASP file generates an error.

    <!-- 
    <div id = "dvGrid" style ="padding:10px;width:550px">
    < this would have been asp  with
    :UpdatePanel ID="UpdatePanel1" runat="server"   >
    <ContentTemplate>
      -->

    The error is resolved by removing the pointy bracket followed by the tag "asp".  This seems to indicate the Microsoft Expression Development Server's HTML/ASP parser is inappropriately processing ASP code when it is enclosed within an HTML comment line.

    HERE'S THE ERROR THE CODE ABOVE GENERATES:

    Server Error in '/' Application.

    Parser Error

    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: The server tag is not well formed.

    Source Error:


    Line 744:  
    Line 745:  <div id = "dvGrid" style ="padding:10px;width:550px">
    Line 746:< this would have been asp  with
    Line 747::UpdatePanel ID="UpdatePanel1" runat="server"   >
    Line 748:<ContentTemplate>

    Source File: /default.aspx    Line: 746

    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17379


    Jose Martin Rosario | Sr. Systems Analyst | www.ScrapRight.com | Toll Free: 877-897-6422 | Fax: 717-307-3517

    Friday, August 17, 2012 12:18 PM

All replies

  • You've commented out the initial <ContentTemplate> tag which is why I suspect you get the error.


    Ian Haynes

    EW - V4 Add-Ins
    EW - Resources, hints and tips
    EW - Design for the Mobile Web
    expression(web.blog)

    Friday, August 17, 2012 1:30 PM
  • The following comment in an ASP file generates an error.

    then..

    Source File: /default.aspx    Line: 746

    Please be exact in your description. ASP is not ASP.NET. They are two entirely different technologies, based upon completely different languages and methodologies. ASPX is an ASP.NET extension, not ASP.

    That said, Ian is correct—your ContentTemplate declaration is malformed.

    cheers,
    scott


    Please remember to "Mark as Answer" the responses that resolved your issue. It is common courtesy to recognize those who have helped you, and it also makes it easier for visitors to find the resolution later.

    Friday, August 17, 2012 2:51 PM
  • To elaborate on the other answers:

    Asp.net is not running the commented code.   But Asp.net is certainly reading the lines and parsing them: how else would it know it's a comment, and where the comment starts and ends?

    The error is not from running the commented code - it's not doing that - but from trying to parse and process the code outside the comments, which you have broken by where you put the comment delimiters.

    Friday, August 17, 2012 6:04 PM
  • I know this is an old question, but for anyone that finds this.

    try using

    <%-- commented code --%>

    I had a problem and this solved it.

    Monday, January 22, 2018 5:56 PM
  • That won't solve the original problem, which was caused by commenting out necessary parts of the page markup.

    Kathleen Wilber
    BrightWillow - Asp.Net Applications

    Tuesday, January 23, 2018 12:37 AM