ASP.NET is a web application framework developed and
marketed by Microsoft
to allow programmers
to build dynamic web sites, web
applications and web services. It was first released in January 2002
with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET
is built on the Common Language Runtime (CLR), allowing
programmers to write ASP.NET code using any supported .NET
language. The ASP.NET SOAP extension framework allows ASP.NET components to process
User controls are encapsulations of sections of pages which are
registered and used as controls in ASP.NET. User controls are created as ASCX
markup files. These files usually contain static (X)HTML markup, as well as
markup defining server-side web controls where the developers place all the
required static and dynamic content. A user control is compiled when its containing
page is requested and is stored in memory for subsequent requests. User
controls have their own events which are handled during the life of ASP.NET
requests. An event bubbling mechanism provides the ability to pass an event
fired by a user control up to its containing page. Unlike an ASP.NET page, a
user control cannot be requested independently; one of its containing pages is
ASP.NET uses a visited composites rendering technique. During
compilation, the template (.aspx) file is compiled into initialization code
which builds a control tree (the composite) representing the original template.
Literal text goes into instances of the Literal control class, and server
controls are represented by instances of a specific control class. The
initialization code is combined with user-written code (usually by the assembly
of multiple partial classes) and results in a class specific for the page. The
page doubles as the root of the control tree.
ASP.NET applications are hosted by a web server
and are accessed using the stateless
HTTP protocol. As
such, if an application uses stateful interaction, it has to implement state
management on its own. ASP.NET provides various functions for state
management. Conceptually, Microsoft treats "state" as GUI state. Problems may
arise if an application needs to keep track of "data state"; for
example, a finite state machine which may be in a
transient state between requests (lazy
evaluation) or which takes a long time to initialize. State management in
ASP.NET pages with authentication can make Web
scraping difficult or impossible.
Application state is held by a collection of shared user-defined variables.
These are set and initialized when the
event fires on the loading of the first instance of the application and are
available until the last instance exits. Application state variables are
accessed using the
collection, which provides a wrapper for the application state variables.
Application state variables are identified by name.
Server-side session state is held by a collection of user-defined session
variables that are persistent during a user session. These variables, accessed
collection, are unique to each session instance. The variables can be set to be
automatically destroyed after a defined time of inactivity even if the session
does not end. Client-side user session is maintained by either a cookie
or by encoding the session ID in the URL itself.
The session variables are
maintained within the ASP.NET process. This is the fastest way; however, in
this mode the variables are destroyed when the ASP.NET process is recycled or
ASP.NET runs a separate Windows
service that maintains the state variabl
es. Because state management
happens outside the ASP.NET process, and because the ASP.NET engine accesses
data using .NET Remoting, ASPState is slower than In-Process. This mode allows
an ASP.NET application to be load-balanced and scaled across multiple servers
State variables are stored in a database,
allowing session variables to be persisted across ASP.NET process shutdowns.
The main advantage of this mode is that it allows the application to balance
load on a server cluster, sharing sessions between servers. This is the slowest
method of session state management in ASP.NET.
The main use for this is to
preserve form information across postbacks. View state is turned on by default
and normally serializes the data in every control on the page regardless of
whether it is actually used during a postback. This behavior can (and should)
be modified, however, as View state can be disabled on a per-control, per-page,
or server-wide basis.
ASP.NET offers a "Cache" object that is shared across the
application and can also be used to store various objects. The
"Cache" object holds the data only for a specified amount of time and
is automatically cleaned after the session time-limit elapses.
Other means of state management that are supported by ASP.NET are cookies,
using the query string