ASP.NET Tutorial

.NET Framework

ASP.NET Introduction

ASP.NET Web Forms

Standard Controls

Label Control

TextBox Control

Image Control

Button Controls

Redirecting User

Using HyperLinks

RadioButton Control

RadioButtonList

CheckBox Control

CheckBoxList Control

DropDownList

ListBox Control

ImageMap Control

Event-Driven Programming

ASP.NET Page Structure

IsPostBack

Master Page

View State

Visibility of Controls

Formatting Controls

Applying CSS

Dynamic CSS

Using Style Class

Themes and Skins

Panel Control

PlaceHolder Control

AdRotator Control

Calendar Control

File Upload, Virtual Path

Validation Controls

Page Navigation

User Control

Separating Code-Presentation

Overview of ADO.NET

Data Binding

DataBinding List Control

.NET Framework

Microsoft provides the .NET Framework SDK (Software Development Kit) as a complete development toolkit for developing console application, windows application, web applications, window services etc.

The .NET Framework consists of huge libraries that can be used in our application. For example, It contains classes for handling database access, working with the file system, manipulating text, performing tasks such as working with regular expressions, etc. It contains classes that represent all the basic data types such as bytes, integers, characters, strings and arrays. The .NET framework also include the Common Language Runtime (CLR) which is responsible for maintaining the execution of all applications developed using .NET Library.

.net framework

.NET Framework Class Library

In ASP, we can access only 5 major objects i.e. Request, Response, Application, Session and Server.

ASP.NET contain a huge library containing classes, interfaces, structures, and enumerated.

CLR

The CLR is responsible for executing your application code. Source code is never compiled directly into machine code. Instead, the compiler converts your code into a special language called Microsoft Intermediate Language (MSIL). MSIL is not CPU-specific. It is a low-level and platform-independent language. When your application actually executes, the MSIL code is converted into machine code by the JIT (Just-In-Time) compiler.

Normally, your entire application is not compiled from MSIL into machine code. Instead, only the methods actually called during execution are compiled.

The runtime environment of the .NET Framework is known as the Common Language Runtime (CLR) because it is common to all the .NET applications and can be used to execute any .NET application. Thus, CLR provides cross-language interoperability to .NET application.

Function of CLR:
  • Memory Management
  • Exception handling Exceptions are errors which occur when the application is executed.
  • Handling security
  • Code execution
  • Garbage Collection Garbage collection is the process of removing unwanted resources when they are no longer required.
.Net Application
Advertisement

Linking

The C# code that compiles into MSIL needn’t be contained in a single file. It is possible to split application code across multiple source code files, which are then compiled together into a single assembly. This process is known as linking. You can separate out logically related code into an individual file, such that it can be worked independently. This also makes it much easier for a team of developers to divide the programming burden.

Garbage Collection

One of the most important features of the managed code is the concept of garbage collection. This is the .NET method of making sure that the memory used by an application is freed up completely when the application is no longer in use. Prior to .NET this is the responsibility of programmers, and a few simple errors in code could result in large blocks of memory disappear. This usually slow down the performance of your computer followed by the system crash.

.NET garbage collection works by inspecting the memory of your computer so often, and removing anything from it that is no longer needed. There is no set time frame for this, it may happen thousands of time per second or once every few seconds.

Benefits of .NET Framework in ASP.NET

  1. Support for web-based user interfaces.
  2. Data Accessibility : The .NET Framework provides a new set of data access objects called ADO.NET, which can be used to access any kind of data located anywhere on the Internet.
  3. Scalability, Availability and Robustness : The .NET Framework can automatically detect errors and manage restarting of applications and components. It can gracefully recover from crashes, deadlocks and memory leaks. The result is that badly behaved applications cannot bring the server down and the applications always appear to be available to genuine users.

ASP.NET Namespaces

Classes are organized into a hierarchy of namespaces. A namespace is a logical grouping of classes. For instance, the system.web namespace contains basic classes for creating web applications. System namespace is the root of the hierarchy. Some of the namespaces in the .NET Framework class library are available in ASP.NET page by default. Some commonly used classes in ASP.NET applications are:

  • System Contains all the base data types. Also contains classes for working with random numbers and dates and times.
  • System.Collections Contains classes for working with standard collection types such as hash tables and array lists.
  • System.Text Contains classes for encoding, decoding and manipulating contents of strings.
  • System.Web Contains the basic classes for working with the World Wide Web, including classes for representing browser requests and server responses.
  • System.Web.Caching Contains classes used to cache page contents and perform custom caching operations.
  • System.Web.Security Contains classes for implementing authentication and authorization such as Passport authentication.
  • System.Web.SessionState Contains classes for implementing session state.
  • System.Web.UI Contains classes used to build the user interface of ASP.NET pages.
  • System.Web.UI.HTMLControls Contains classes for HTML controls.
  • System.Web.UI.WebControls Contains classes for Web controls.

.NET Framework-Compatible Languages

VB.NET is the default language for ASP.NET pages. ASP.NET supports several other languages (both Microsoft and non-Microsoft products) that support the .NET runtime environment. These include C#, Visual C++, JScript.NET and Python, SmallTalk, Eiffel, and COBOL.

ASP.NET pages are compiled and therefore execute quickly. They are always compiled into an intermediate-level language called Microsoft Intermediate Language (MSIL). The first time a user requests your ASP.NET page, the page is compiled into a .NET class (in the MSIL format). This class file is saved in a directory known as Temporary ASP.NET Files on the server. When the same page is requested again, the corresponding class file is executed. The class file is compiled with the .NET Framework Just-in-Time (JIT) compiler into native machine code and executed.

Such a two-step compilation method offers the following advantages:

  • Compiling and caching the source code in an intermediate format reduces the response time as compared to interpreting and executing the source code at runtime.
  • The IL code can be executed on any platform, as it is in a binary format.