Compartir a través de


Server-Side Comments

Allows you to include code comments in the body of an .aspx file. Any content between opening and closing tags of server-side comment elements, whether ASP.NET code or literal text, will not be processed on the server or rendered to the resulting page.

<%-- commented out code or content --%>

Remarks

ASP.NET server-side comment blocks have the same uses as traditional language-specific comment blocks, including documentation and testing.

Within <script runat="server"> </script> and <% %> blocks, you can use comment syntax in the language that you are coding in.

A compilation error will occur if you use server-side comment blocks within <% %> blocks.

The opening and closing comment tags can appear on the same line of code or can be separated by many commented-out lines.

Server-side comment blocks cannot be nested.

Example

The following example demonstrates an HtmlButton control that is commented out.

 <%-- <button runat="server" id="MyButton" OnServerClick="MyButton_Click">
            Click here for enlightenment!
      </button>
 --%>  

See Also

Introduction to Web Forms Pages | ASP.NET Page Syntax