Home > Getting Started > ASP.NET Syntax > ASP.NET Page Syntax > Server-Side Comments
ASP.NET Syntax ASP.NET Page Syntax
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 --%
>
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.
The below code snippet demonstrates an HtmlButton control that is commented out.
<%-- <button runat="server" id="MyButton" onServerClick = "MyButton_Click">
Click here for enlightenment!
</button>
--%>
Introducing ASP.NET Web Forms