Code-Behind Web Pages

One of the primary benefits of ASP.NET is that it supports structured programming. The most significant contribution to this is code-behind Web pages, modules of program code that are separate from the page itself. A code-behind Web page is simply a file of C# code that is compiled and executed on the server when an ASP.NET Web page is requested. Technically the code-behind page doesn't get re-compiled unless the Web server is restarted or the code is replaced. Code-behind Web pages promote structured programming by separating control logic, which belongs with the code-behind page, from presentation logic, which is part of the main ASP.NET page. Listing 20.4 shows how to use code-behind Web pages.

Listing 20.4. ASP.NET Web ...

Get C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.