Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

web application

What is ASP.NET Web Forms?

Emmanuel Ajibode

ASP.NET Web Forms is a programming model supported by Microsoft’s ASP.NET technology that is used to create dynamic web applications and websites.

It is built on the Microsoft .NET Framework. This provides all the benefits of the .NET Framework, including a managed environment, type safety, and inheritance. It is also flexible because you can add user-created and third-party controls to it.

There are three programming models you can use to create ASP.NET web applications. The other two, besides ASP.NET Web Forms, are ASP.NET MVC (Model, View, Controller) and ASP.NET Web Pages.

ASP.NET Programming Models
ASP.NET Programming Models

ASP.NET Web Forms applications execute on the server and generate output to the browser. A programming language that supports the .NET Common Language Runtime (CLR), such as C# or Visual Basic, is used to write ASP .NET Web Forms applications.

ASP.NET Web Forms server controls

The main building blocks of ASP .NET Web Forms pages are server controls. These are reusable components responsible for rendering HTML markup and responding to events. There are three kinds of server controls:

  • HTML server controls
  • Web server controls
  • Validation server controls

HTML server controls

HTML server controls are standard HTML controls, converted into a server control by adding the attribute runat=“server” and adding an id to make them available for server-side processing. The use of the id is to manipulate the HTML server control at run time. For example, consider the HTML standard input control:

<input type = "text" size = "50">

It can be converted to a server control by adding the runat and id attributes:

<input type = "text" id = "servertext" size = "50" runat = "server">

Web server controls

Web server controls are a unique set of ASP.NET tags understood by the server. They are created on the server and require a runat=“server” attribute to work. However, Web server controls do not necessarily reflect HTML syntax.

Web server controls include form controls, such as radio buttons, text boxes, checkboxes, as well as special-purpose controls, such as menus and calendars.

Using textbox control as an example, we can create a Web server control with the following syntax:

<asp : textbox text = "Edpresso Competition" id = "some_id" runat = "server"/>

Validation server controls

Validation server controls perform client-side validation, server-side validation, or both, depending on the browser capabilities that display the page.

The validation server control validates the values entered by users into other controls of the page. The user gets an error message whenever the user input does not pass validation.

The syntax for creating a validation server control is as follows:

<asp : control_name id = "some_id" runat = "server"/>

Components of ASP.NET Web Forms

ASP.NET Web Forms consist of three components.

The first is the ASP.NET framework, which consists of the Web Forms and the .NET Programming Language used to write the code behind the Web Forms.

The second is the server, which executes the Web Forms and generates the HTML markup that the browser can render.

The third is the browser, which displays the web page when requested by a user.

Components of ASP.NET Web Forms
Components of ASP.NET Web Forms

The diagram above is of IIS (Internet Information Server), one of the most popular Web servers created by Microsoft. It is used in hosting ASP Web applications and provides Internet-based services.


web application

View all Courses

Keep Exploring