Labels

Tuesday, August 28, 2007

Server Side vs Client Side Comments

One common question people ask is what the difference is between using client-side HTML comments and server-side comments.

The key difference is that with client-side comments

· It is the browser which is ignoring the content within them.

· Code/controls within client-side comments will still be executed on the server and sent down to the browser.

· As such, if there is a server error caused within them it will block running the page.

With server-side comments,

  • The ASP.NET compiler ignores everything within these blocks at parse/compile time, and removes the content completely when assembling the page (like its contents weren’t there at all).
  • Consequently, any errors caused by mal-formed controls or issues with inline code or data-binding expressions within them will be ignored.
  • The page is also just as fast with controls/code within server-side comments as if there were no controls/code on the page at all (there is no runtime performance overhead to them).

Thanks & Regards,

Arun Manglick || Tech Lead

No comments:

Post a Comment