6.5. Web forms pages

Web forms is the technology that allows us to create programmable web pages that comprise the ASP.NET application. A web form – commonly referred to as an ASP.NET or ASPX page – consists of two components: visual elements and code. With ASP.NET we have two ways to create our pages. We can continue to work the “ASP way” – to mix our code and HTML code – or completely separate them. The latter is called the code-behind technique and it works in the following way:

  • we create a .VB or .CS file that contains all the code;

  • this code can be compiled and placed in the \bin directory;

  • we can force the compilation on demand by using the src attribute of the @ Page directive.

Let’s look at an example. Suppose we want to partition our ...

Get A Programmer's Guide to .NET 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.