Monday, January 16, 2012

ASP.NET-Show Maintanence page

App_Offline.htm

Feature in ASP.NET 2.0, which provides a super convenient way to bring down an ASP.NET application while you make changes to it.

The way app_offline.htm works is that you place this file in the root of the application.

So if you use the app_offline.htm feature, you should make sure you have at least 512 bytes of content within it to make sure that your HTML  shows up to your users.

ASP.NET- HTTPModule and HTTPHandler

HTTP handlers: Extension based processing
HTTP Module : Event based processing

Typical uses for custom HTTP handlers include the following:
RSS feeds To create an RSS feed for a Web site, you can create a handler that emits RSS-formatted XML. You can then bind a file name extension such as .rss to the custom handler. When users send a request to your site that ends in .rss, ASP.NET calls your handler to process the request.
Image server If you want a Web application to serve images in a variety of sizes

Typical uses for HTTP modules include the following:
Security
Statistics and logging
Custom headers or footers Because you can modify the outgoing response, you can insert content such as custom header information into every page or XML Web service response.


ASP.NET- Web farm and Webgarden

Web gardens are different from Web farms.

·         A Web garden is configured on a single server by specifying multiple worker processes for an application pool. 

·         Web farms use multiple servers for a Web site

The default value for the MaxProcesses property is 1, which is the default number of worker processes that service an application pool. To configure an application pool so that it is a Web garden, set the MaxProcesses property to a value greater than 1.


ASP.NET-IIS Life cycle

The process name is "WebDev.WebServer.Exe" which actually takes care of all request and response of an web application which is running from Visual Studio IDE.

Worker Process: 
Worker Process (w3wp.exe) runs the ASP.Net application in IIS. This process is responsible to manage all the request and response that are coming from client system. 

Application Pool: 
Application pool is the container of worker process.  Application pools is used to separate sets of IIS worker processes that share the same configuration.
The worker process serves as the process boundary that separates each application pool so that when one worker process or application is having an issue or recycles, other applications or worker processes are not affected.

Web Garden:
Application Pool with multiple worker process is called Web Garden

When client request for some information from a web server, request first reaches to HTTP.SYS of IIS.
HTTP.SYS then send the request to respective  Application Pool.
Application Pool then forward the request to worker process to load the ISAPI Extension which will create an HTTPRuntime Object to Process the request via HTTPModule and HTTPHanlder.
After that the ASP.NET Page LifeCycle events starts.


ASP.NET- Page life cycle

(SILVER)
Start
Request and Response are set.
Page initialization
Controls on the page are available and each control's UniqueID property is set
Load:
Control properties are loaded with information recovered from view state and control state.
Validation:
Validate method of all validator controls is called
Event handling:
If the request is a postback, any event handlers are called.
Rendering:
Page calls the Render method for each control, providing a text writer that writes its output to the OutputStream of the page's Response property.