ASP.NET Server-side Comments

When working with an ASP.NET page or control you many want to remove code temporarily or stop some code executing while debugging. This can be achieved easily using the server-side comment opening, <%--, and closing tag, --%>.

The syntax is often forgotten and is very useful as you can place it around anything and the contents will be ignored:

<h1>Server-side Comments</h1>
<%--
	<p>Everything inside the comments tags is ignored.</p>
	<asp:Image runat="server"></asp:Image>
	<%= "Hello" %>
--%>
This entry was posted in Programming and tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

*
*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

* = Required