Microsoft .NET is a framework for distributed, portable,
scalable computing. This article discusses the features of the framework and
the related terminologies, provides an insight to its architecture, and then
discusses ASP.NET, ADO.NET, Web Services, Remoting, and the robust security
model that this framework is designed on.
Features of the .NET Framework
The Microsoft .NET Framework has the following features:
·
Portability
·
Cross Language Integration
·
Interoperability
·
Common Runtime Engine
·
Base Class Library
·
Fast development
·
Simplified Deployment
·
Security
The Common Language Specification
It is a set of language-independent conventions intended to
promote language interoperability for programs running inside the runtime
environment. It defines types, methods, properties, fields, etc.
The Common Type System
The Common Type System (CTS) is a standard that defines a
set of types and rules for creating new types and enables multi-language
integration in the .NET environment. The common type system supports the
following types:
·
Value Types
·
Reference Types
Value types are created in the stack, and reference types
are created in the managed heap. The primitive types, structs, and enums are
all examples of value types. Reference types are arrays, objects, etc. The
conversion of a value type to a reference type is called boxing; un-boxing is
the conversion of a reference type to a value type.
At runtime, the type checker ensures the validity of all
objects within the runtime environment. It makes sure that only valid
operations are performed on the code and throws exceptions on violations of the
same.
.NET Framework Class Library
The .NET Framework Class Library (FCL) is a set of managed
classes that provide a lot of services. The following are some of the language
independent services provided by the FCL:
·
File Handling
·
Remoting
·
Sockets
·
Database access
·
XML
The Common Language Runtime
The CLR is a runtime engine that handles memory allocation,
security, code verification, type verification, exception handling, and garbage
collection. Managed code is one that runs in the context of the CLR and is
hence managed by the common language runtime itself.
The source code in .NET is compiled to an intermediate
language called the Microsoft Intermediate Language or the MSIL. This is then
converted to the native code at runtime by the Just In Time Compiler (JIT).
CLR Services
The CLR provides a lot of services for applications that run
in the .NET environment. These include:
·
Just In Time Compilation
·
Memory management and isolation of the application memory
·
Garbage Collection
·
Code Verification
·
Code Access Security
·
Verification of type safety
·
Exception handling
·
Conversion of the MSIL to the native code
·
Access to metadata
Assembly
An assembly is a group of resources and types, along with
metadata about those resources and types, that is deployed as a single unit.
MSIL
The source code of the .NET languages is not converted into
the native code. Rather, it is compiled into a machine-independent intermediate
code known as Microsoft Intermediate Language or the MSIL.
The JIT compiler
The MSIL code and metadata are loaded into the memory with
the help of Common Language Runtime (CLR). The JIT compiler then compiles the
MSIL code to native code and executes it at runtime. The JIT does not convert
the entire MSIL code to its native equivalent. Rather, it does so in demands,
i.e., the portion of the current execution code is converted and loaded into
the memory. Hence, it works the same way that Demand Paging works in Virtual Memory
supporting Operating Systems.
Garbage Collection
The Garbage Collector is responsible for cleaning up the
unused objects in the runtime environment. Objects are generally created in the
managed heap. Here the term 'managed' implies that it is cleaned implicitly by
the Garbage Collector. The garbage collector works based on these principles:
·
Small objects are generally short-lived and frequently accessed.
·
Larger objects are longer-lived.
·
Heap compaction of the large objects to minimize heap fragmentation
Code Verification
This is a feature that enforces type safety and checks the
code prior to its execution in the runtime environment. This disallows illegal
operations inside the runtime environment and hence prevents an application
running in the context of the runtime environment from crashing. Programs
running in the runtime environment have restricted access to memory and devices
of the system.
ASP.NET
ASP.NET is a language-neutral, interoperable server side
technology that allows creation, execution, and deployment of scalable Web
Applications and Services. The advantages of ASP.NET over traditional ASP are:
·
Language Neutrality
·
Code Separation with the help of code behind file
·
Better State Management
·
Enhanced XML support
·
Support for pre-compilation of the ASP.NET pages
ADO.NET
ADO.NET provides support for data access in Microsoft .NET
and its features include:
·
Support for disconnected data access model
·
Integration with the .Net framework
·
XML support
This model can, however, only be used from the managed code
environment. This implies that there is no COM interoperability allowed for
ADO.NET.
Web Services
A web service is a platform–independent software component
that contains a group of functions that are packaged together for use in a
common framework throughout a network. Web services are based on the Simple
Object Access Protocol or SOAP.
.NET Remoting
This is a concept that enables different applications
residing on remote systems to communicate with one another. The .NET objects
are exposed to remote processes, hence allowing inter-process communication
between even remote systems. The remote objects are accessed through channels
that physically transport the messages to and from the remote objects.
.NET Security
Microsoft .NET follows compact security architecture that is
basically composed of but is not limited to:
·
Authentication
·
Authorization
·
Impersonation
The .NET Framework uses authentication to verify the
credentials of the individual users. Authorization is used to determine the
accessibility of a particular resource that a user is entitled to.
Impersonation is the process by virtue of which a resource can be accessed
under a different identity. The following are the types of security that the
.NET Framework supports:
·
Code Access Security (CAS)
·
Evidence Based Security
·
Role Based Security
·
Declarative and Imperative Security
·
Cryptography
Conclusion
Microsoft .NET is a device and platform-independent
distributed computing model based on open XML communication technology and
helps integrate users, devices, and applications for the different
environments. It promises to be the technology of choice for building robust,
scalable, portable applications for a long time to come.
For Further Reading
http://www.midnightbeach.com/jon/pubs/2002/BorCon.London/dotNetArchitecture.html
http://www.gotdotnet.com/team/clr/about_clr.aspx
http://www.gotdotnet.com/team/clr/about_security.aspx
http://www.c-sharpcorner.com/Code/2002/Aug/GCinNet.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconthecommontypesystem.asp
http://www.c-sharpcorner.com/Articles/CompilationOfCSharpProgram.asp