All pages (.aspx) are parsed into classes and compiled into assemblies

Assemblies are loaded on-demand into the worker process (w3wp.exe)

Classes are created on demand to service requests

You work with ASP.NET by

Building additional classes

Extending base classes

Controlling class generation from .aspx files

Everytime an aspx file is requested, it does go through a class creation mechanism, and the first time it’s requested it go through the parsing of the file and the source code generation for that class.

In ASP.NET, we decorate code behind class with partial, when we request to an aspx file, that file will be generated to a class which is also a partial class of code behind file. All controls in aspx will be declared as protected variables in generated class.

6. Page Life Cycle

List of events/functions: (common one in bold)

PreInit (only place that we can manipulate master pages and themes)

Themes initialized, master pages applied, control skins applied

Init (at this point, controls have already been constructed in control tree and we can inspect the control tree)

AutoEventWireup set to true so instead of wiring up event ourself, we can declare some special events and page will automatically subscribe to it. Example: Instead of overriding OnLoad event, we can set AutoEventWireup = “true” and use Page_Load.

Some special ASP.NET directories

8. Shadow copying (a feature of .NET runtime)

Assemblies (libraries) placed in /bin are

implicitly referenced by every compiled page

shadow copied to an alternate location to avoid file locks

monitored for changes to shadowed copies can be updated

This is an important feature when you deploy a new update to your website in order to keep the site running. When you are loading an assembly, instead of loading the assembly directly from the location it’s deployed (/bin), .NET will implicitly copy that to another location. And it will reference that one instead. Also, it will add a timestamp to the original one, then if there is a new update on the original one, it will make another copy and refer to that copy instead.