page life cycle (the internal of request and response process in

As you all know that request and response process is very common, but for any non developer or user’s point of view it’s just a process of calling or requesting for a page through typing the name of page or clicking on a link of page, the requested page will gets found and will display on user’s browser as simple as that.
But the internal process of request and response is far complicated then it looks like. As a web developer it is very important to understand the internal working process of request and response, what happened when user send request to server, how web server get the request and then response back to user.
So in this post I will try to explain the internal process of page request and response and try to clear your concept on page life cycle.

In the process of a request for page from user’s browser, then request acquired by web server and then server sends response back to the user’s browser. In between these processes IIS (Internet Information Services) performs and maintains collection of stuff.

Small Intro of IIS (Internet Information Services) 

IIS is a web server software, which waits for browser requests and serves the appropriate pages.
In a simple word, when you want your website to be publically accessible through the internet, you need to publish it on IIS web server (in case of ASP.NET).

A variety of colors of IIS

• Windows XP Professional comes with IIS 5.1. (Previous version or other editions of Windows XP don’t include)
• Windows Server 2003 comes with IIS 6.
• Windows Vista and Windows Server 2008 come with IIS 7.

IIS request and response phenomenon 

Initial handling is actually performed by the kernel-mode HTTP driver http.sys.When user sends a request to IIS,request goes through ISAPI filter . ISAPI.dll checks requested file extension and performs further action accordingly in the case of .aspx page then it sends to ASPNET_ISAPI.dll extension to process request. As explained in picture below:

IIS request handling

IIS checks whether it is the first request for the website or not then a class called ‘ApplicationManager’ creates an application domain where the website can run. The application domain is responsible for maintain isolation between two or multiple  web sites hosted on the same IIS web server. After that http runtime object created to create hosting environment for all aspx page. Once the hosting environment is created, the compulsory core  ASP.NET core objects (HttpContext , HttpRequest, HttpResponse). After that main object is created which is responsible to serve the .aspx page is called HttpApplication. In case if website has global.asax file available then the object of global.aspx class is created.
HttpApplication object has the command of all core object of that created earlier. Now HttpApplication of object process the request by calling HttpModules, HttpHandlers and Page events.

These three objects invokes different events that can be  used by developer to insert  logic within that as required.

HttpHandler :

HttpHandler is an extension based processor that means it checks the extension of requested file and then calls appropriate handler. To get more clear see the image below :


HttpModule :

HttpModule is an event based processor, that means we can insert code in ASP.NET pipeline events. ASP.NET pipeline events are listed in the order that they occur:

Description of all above Event below :

This event indicates that a new request occurred  and guarantees to be raised on each page request.

This event indicates that ASP.NET runtime is ready to authenticate the user and any authentication code can be injected here as required.

This event indicates that ASP.NET runtime is ready to authorize the user and Any authorization code can be injected here as required.

In this event, ASP.NET runtime take decision whether the page can be served from the cache rather than loading the original for increase the performance. Any caching specific code can be injected here.

This event indicates that ASP.NET runtime is ready to acquire session variables.

This event is indicates that to handling control to the HttpHandler can be done and required code can be injected.           

In the case of HttpHandler defined in page ,Httphandler logic is can be written logic which needs to be executed as per page extensions.

Page  Init
This event raised just before page load and code like Creation of controls dynamically, Any initialization  etc.

This Event guarantees that ASP.NET controls are fully Loaded and you write code logic as required.

If you have any validation controls  on your page, you can check whether validated or not and write code as required.

When request processed by the server then it need to be send back to user’s browser rendered as simple html code, so before rendering you can insert final code to change something you want.

This event is called when Page object is going to unloaded and released all created objects from the memory.

This event occurs after the handlers are executed successfully any code logic can be injected here.

In this event all saved state for page gets released you can save state
variables like session variables if you need.

In this event you can update your cache if you need.

The End of the Request.
I hope so that this post help you to understand the lifecycle of ASP.NET Page.

Video Reference 

Differences between ASP and ASP.NET (Most often but confusing question for novice developers)

Most novice developers think that asp and is same, but guys there are a lot of differences between ASP and ASP.NET. Asp is an old day style of web development in which a bunch of ASP code were used to embed in between html codes. On the other hand, ASP.NET has giant .Net Library support and compiled language support like C#.NET,Visual Basic .NET.
Here are some more differences between ASP and ASP.NET below

  1. ASP is Interpreted language based on scripting languages like Jscript or VBScript.
  2. ASP has Mixed HTML and coding logic in a single file.
  3. Limited development and debugging tools available.
  4. Some degree of OOPS support.
  5. It doesn’t support xml.
  6. Insufficient session and application state management.
  7. ASP session state relies on cookies.
  8. ASP has no inbuilt facility for Validation of controls.
  9. Extension of asp web page is *.asp.

  1. ASP .NET is fully Object Oriented Programming.
  2. ASP.Net has .NET library support and has compiler and compiled language support hence more secure then ASP.
  3. ASP.NET has xml support for easy data exchange.
  4. Separate code and design logic possible.
  5. It supports to create Multilanguage pages like one page in c# language or other page in VB.NET as well in same website.
  6. Variety of tools available includes the Visual studio.Net.
  7. ASP has supports inbuilt Rich Validation set of controls like RequiredFieldValidation, CompareValidator, RangeValidator, RegularExpressionValidator, CustomValidator Control.
  8. Complete session and application state management.
  9. Full XML Support for easy data exchange.
  10. ASP.NET session state relies on cookies as well as server.
  11. Extension of ASP.NET pages is *.aspx

Video Reference 

Fundamentals of ASP.NET and stuffs that need to know before start with ASP.NET web development

Okay friends to get started you have to have some very basic idea and awareness about generic terms, rules and ‘why n how’ of everything that is used in web development.  Here I am explaining about some of them below that you need to know:

Flavors of ASP.NET

With a new flavor of ASP.NET 4 Microsoft again refining and enhancing ASP.NET. It has old functionality as well as News Dynamic features that give a pace to developers and to make their programming more productive.
      ASP.NET 1.0 :- This version created the core ASP.NET platform and introduced a collection of features.
       ASP.NET 1.1 :- This version only refined with bug fixes that increased the performance.
       ASP.NET 2.0 :- This version came with huge set of new features on top of the ASP.NET previous version.
       ASP.NET 3.0 :- This version was just for filling gaps of technologies, it doesn’t touch the core of but added new framework including Windows Presentation Foundation (WPF), Windows Workflow Foundation (WWF) and Windows Communication Foundation (WCF).
       ASP.NET 3.5 :- This version kept the same basic engine as ASP.NET 2.0, but adds a few add-ons. The most significant enhancement is the ASP.NET AJAX toolkit, which gives web developers better tools for creating highly responsive web pages that imitate the desktop applications (such as drag-and-drop and auto complete, Modelpopup etc). Also respect to Database it added LINQ that gives a platform to play with database queries more concisely with Architectural support of MVC.
       ASP.NET 4.0 :- This version added Dynamic data, enhancement of MVC and much more on top of ASP.NET 3.5.

Request and Response

HTTP Request :- A user sends a path of a file also called URL(Uniform Resource Locator) like ( Welcome.aspx ) that is store in somewhere on the web server on the internet via browser (User Agent) using Get Method, is called  HTTP Request.
HTTP Response :- On the server side as name suggested, it receives request and then try to resolve the address and searches for that requested file on the server if requested file found then it returns that file to the user ,this process called HTTP Response. See picture below

Request and Response
IIS (Internet Information Server) :- Internet Information Server is one of the most powerful web servers Powered by Microsoft that is used to host and run  ASP.NET web applications. IIS has its own ASP.NET Process to handle ASP.NET requests.See picture below

IIS (Internet Information Server)