ASP.NET is a platform for web development that was provided by Microsoft. It is useful in creating web applications as well as mobile applications. Its first version was released in the year 2002, and the first version was 1.0. It works with HTTP protocol, which is a standard protocol that is used across all web applications.
It can be written in various languages such as C#, Visual Basic .NET, Jscript, and J#. Here ASP stands for Active Server Pages, and .NET stands for Network Enabled Technologies.
Given below are some of the things that are added by ASP.NET to the .NET platform:
- It provides a base framework for processing of the requests in C# or F#.
- It provides libraries for common web patterns, including MVC.
- It provides a web page templating syntax named Razor, which is used to build dynamic web pages.
- It contains an authentication system that includes libraries, template pages for handling login (multi-factor authentication and external authentication with Google, Twitter, etc.), and a database.
- It also contains editor extensions that provide syntax highlighting, code completion, and much other functionality.
The architecture of ASP.NET:
ASP.NET works on a 3-tier architecture that increases application performance, reusability of code, scalability, flexibility. The 3-tiers are:
- Data Layer
- Business Layer
- Presentation Layer
It manages data storage and retrieval. All the program code that is related to the database is written here. It contains methods that help to establish a connection with the database. It contains methods to perform insertion, updating, creation, deletion with the help of SQL Query.
It contains all the business rules and logic. It acts as a medium between the data layer and the presentation layer. It contains the logic that is related to the validation of data. For example, a user wants to register on some portal. He fills all the details and clicks on the submit button. This view comes under the presentation layer. It then calls the business layer, which contains the function and parameters provided by the end-user.
It helps to manage the user interface and presentation code. It contains pages like .aspx or forms where data is present to the user, and the user enters the information. This layer then communicates with the business layer.
The main features of this 3-tier architecture are:
- Scalability: You can deploy the application on multiple servers, which makes the system more scalable.
- Flexibility: All layers contain separate codes, thus making it flexible to make changes.
- Reusability: It is easier to reuse the code by separating the application into multiple layers.
- Maintainability: As all the code is separated and available in different layers, it becomes easy to maintain the application.
Components of ASP.NET:
It mainly contains three components:
1] Language: It contains a variety of languages such as VB.NET, C#, F#. These are used to develop web applications.
2] Library: It contains a set of libraries. The most common library is the Web Library. Web Library contains all the necessary components which are required for the development of web applications.
Framework Class Library (FCL) also called as Base Class Library. Following are the applications which can make use of this library:
- Console Applications
- Windows Applications
- Web Applications
- Windows Services
- XML Web Services
3] Common Language Runtime (CLR):.NET programs are executed on Common Language Interface (CLI) platform. CLR is responsible for performing activities like Exception Handling and Garbage Collection.
Language compilers convert the code language to Microsoft Intermediate Language (MSIL), which is then converted to native code by CLR.
There are over 15 language compilers that execute under CLR.
Characteristics of ASP.NET:
- Code Behind Mode: This concept separates the design and code of an application. Due to this separation, it becomes easy to maintain the application. Suppose we have a page called Student.aspx. There is also another file Student.aspx.cs, which denotes the code part. So Visual Studio creates a separate file for each page.
- State Management: HTTP is a stateless protocol. State management can be controlled with the help of this protocol. Suppose in a shopping cart application, a user, after deciding what to buy, clicks on the Submit button. The application remembers the item which the user has chosen. This is remembering the state of an application.
- Caching: Caching improves the performance of an application. This concept caches those pages which are frequently requested by the user, and this can be stored in a temporary location. Thus pages can be retrieved faster and better responses can be sent to the user.