Archive, ASP.NET
     

Comments In ASP.NET

Comments in HTML come in handy to temporarily remove site content. As ASP.NET developers, we have HTML comments available to use. In any ASPX markup file you can simply use the comment notation.

Unfortunately HTML comments can be seen by anyone view your site’s HTML. Additionally any runat server controls will still be executed. For those reasons HTML comments are not always a viable way to comment out portions of ASPX markup. Fortunately ASP.NET has a way to resolve both of those issues.

The ASP.NET comment takes the form of:

	<%--
		commented out code, or programmer remarks here
	--%>

ASP.NET comments, like comments in C# and other languages, are thrown away by the compiler.

ASP.NET comments prevent their content from reaching your users browser, and also prevents server controls from being compiled and executed. Often times ASP.NET comments are the best choice for comments in your ASPX markup.

Never miss an article! Subscribe to my newsletter and I'll keep you updated with the latest content.

 

About Jason

Jason is an experienced entrepreneur & software developer skilled in leadership, mobile development, data synchronization, and SaaS architecture. He earned his Bachelor of Science (B.S.) in Computer Science from Arkansas State University.
View all posts by Jason →

Leave a Reply

Your email address will not be published. Required fields are marked *