ASP.NET Web Page

An ASP.NET web application consists of multiple web pages. To create applications it is imperative to understand what makes an ASP.NET Web Page or also called a web form. Everything your users do or see is on a web form. A web form has a User Interface and code that allows the users to interact and send data. They include event procedures, properties and method along with the controls on a web form.

Web forms are to be run on browser on the request of a user when they type in the url of the application. So there are two types of codes working in a ASP.NET Web Page made using ASP.NET. The web forms have HTML code for displaying the form in browser and code in any .NET language that defines the logical functioning of the web from.

Component files of  an ASP.NET Web Page

A web form have these two file types. (A web form named UserRegistration)


The file with .aspx represents the UI of the web form. It constitutes of the HTML code created by ASP.NET framework for the controls placed on the web form.

On top of the source code of this file you can see the @Page directive. It is used for describing the web form’s details for server to process and send an HTML file to be rendered in client browser.

ASP.NET web page header

Whenever a user requests a specific web form server compiles the codebehind file into a dll (dynamic Link Library) file and sent back as response to user request. Any subsequent requests are fulfilled this dll is executed to respond. Server doesn’t need the source code after that to fulfill client requests.

.aspx.vb or .aspx.cs

For example UserRegistration.aspx.vb (if you are using VB.NET language) UserRegistration.aspx.cs (if you are using C# language). This file contains all the event procedures you code by opening the code window. It is just like coding in a windows application.  You double click a control placed on the web form and the code window opens with the default event. Like for a button “Click” event opens.

So a web form in ASP.NET has separate file for visual elements and code in a separate class ending in the name of the programming languages of the code(.vb or .cs).

This model allows a programmer to separate the client side scripting and server side scripting.  By default all scripts will run on server (attribute runat=”server” ). But if you need a client side script you can write it in the .aspx source file in <script> </script>tags.

This model is quite a good option to implement re-usability. It can be used or inherited by other web forms implementing same functionality.