SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Presented By : Abhishek Sur
http://www.abhisheksur.com/
Table of Content
 Introduction
 Application Life Cycle
 IIS Request Process
 Application Pool
 Worker Process
 HTTP Handler/Module
 ASP.NET Page Life Cycle
 Page Life Cycle Steps
 Page Life Cycle Events
 Life Cycle for Master Page and User Control
 QA
Introduction
 When Clients request for an aspx page from browser
and lot of stuffs happens in background to produce the
output or sending response to client. This evolves
ASP.NET Page Lifecycle.
 ASP.NET Page Life Cycle is very much important to
know for each and every developer to developed an
ASP.NET Web Application.
 All events, data processing, dynamic control creation,
view state, postback, rendering etc. are depends with
Page Life Cycle.
Application Life Cycle
1. Client Request For Information
2. Request comes to Server
3. Server Process the request
4. Send the response back to Client
Application Life Cycle - Contd.
 Key terms to remember
 HTTP.SYS
 WAS
 Application Pool
 Worker Process
http://blogs.thesitedoctor.co.uk/tim/2006/06/30/Complete+Lifecycle+Of+A
n+ASPNet+Page+And+Controls.aspx
Application Life Cycle – Contd.
 Key Terms To Remember
 Http Module
 Http Handler
 Http Pipeline
End Of Application Life Cycle – Start Page Life Cycle
 Request Passes Through HTTP Pipe Line
 This Start Page Life Cycle
ASP.NET Page Life Cycle Begins
 Start
 Initialization
 Load
 Validation
 Events
 Render
S I L
VER
Page Life Cycle - Start
 Client Request For Resource
 Request Comes To Server (IIS)
 IIS Process the Initial Processing
 Request Passed through HTTP- Pipe Line
 ASP.NET Page Life Cycle Starts
Page Life Cycle - Initialization
 Set Postback properties
 Unique ID for Each Control in the Page
 Themes needs to be initialized
 Dynamic control need to be created
Page Life Cycle - Load
 If the Request is the post back request then it loads
data from View States and Control State
Page Life Cycle - Validation
 Validate the pages Control
 Updates the IsValid property
Page Life Cycle - Events
 This will only fired if the request is an postback event.
 Like, if the post back is happened for an Button Click.
Button Click event will fired.
Page Life Cycle - Render
 Before Rendering All View State data has been set.
 Render() method for all control has been called and
write the out put on output stream.
Page Life Cycle - Events
http://msdn.microsoft.com/en-us/library/ms178472.aspx
ASP.NET Page Life Cycle Events
 PreInit
 Init
 PreLoad
 Load
 Control Events
 PreRender
 SaveViewState
 Render
 Unload
Page Life Cycle – Events
 PreInit()
 This is the first event which raised in asp.net page lifecycle
 Check for Request is for Post Back or not.
 All dynamic control need to be created
 Theme Change, Master Page Set at runtime
 Init()
 Raised after all controls have been initialized
 Build up a tree of controls from the ASPX file
 Turn on view state monitoring – any changes in control will be
tracked by View State for future.
Page Life Cycle - Events
 PreLoad()
 Load view state data for page and controls
 Load Postback data if needed
 We can process any kind operation that need to perform
before page load
 Load()
 OnLoad methods control called for each and every control
 We can create the connection initialization for any kind of
external source like database connection
 We can also set the control properties
Page Life Cycle - Events
 Control Events
 If this is an postback request , Corresponding events will triggered.
Like, if the post back is happing for button click, then Button_Click
Event will fired.
 PreRender
 Each control of the page has a PreRender event which is being
invoked.
 EnsureChildControls is also being called during this events
 DataBind method for all control has also been called
 If we want to change any thing to any control this is the last event
where we can do because after the pageRender starts
Page Life Cycle - Events
 SaveViewState
 ViewState Monitoring is turned off as here all the ViewState
Data need to be saved.
 View State data saved in hidden filed called _VIEWSTATE
 Render
 Pages calls the Render method for each and every control.
 Text writer that writes the output to the as output stream
 Output steam set to the page's Response property.
Page Life Cycle - Events
 Unload
 This is the last event of asp.net page life cycle
 This ensure the Request and Response has been set to null.
 This is called only after the content of the page fully rendered
and response sent to client
Page Life Cycle - Master Page and User Controls
 MasterPage gets initialized from the Page class in the init phaze
of page. The content of Masterpage gets loaded side by side as
the page gets loaded.
 User control will be initialized and added to the page and before
page gets initialized
 After page Onload, MasterPage_OnLoad gets called and
UserControl_Onload gets called sequentially.
 Followed by each of Page events, masterPage events gets called
and next Usercontrol events are called.
 During the unload phaze, Usercontrol gets unloaded first and
then masterpage and Page in sequence.
 For further reference refer to :
http://blogs.thesitedoctor.co.uk/tim/2006/06/30/Complete+Life
cycle+Of+An+ASPNet+Page+And+Controls.aspx
Q/A
Thank you

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 
Asp net
Asp netAsp net
Asp net
 
Java awt
Java awtJava awt
Java awt
 
ES6 presentation
ES6 presentationES6 presentation
ES6 presentation
 
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
 
Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
Css
CssCss
Css
 
PHP Cookies and Sessions
PHP Cookies and SessionsPHP Cookies and Sessions
PHP Cookies and Sessions
 
Web forms in ASP.net
Web forms in ASP.netWeb forms in ASP.net
Web forms in ASP.net
 
JavaScript - Chapter 11 - Events
 JavaScript - Chapter 11 - Events  JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events
 
Assemblies
AssembliesAssemblies
Assemblies
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
ASP.NET Basics
ASP.NET Basics ASP.NET Basics
ASP.NET Basics
 
JavaScript Objects
JavaScript ObjectsJavaScript Objects
JavaScript Objects
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
 
CSS
CSS CSS
CSS
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 

Ähnlich wie ASP.NET Page Life Cycle

Ähnlich wie ASP.NET Page Life Cycle (20)

Aspnetpagelifecycle 101129103702-phpapp02
Aspnetpagelifecycle 101129103702-phpapp02Aspnetpagelifecycle 101129103702-phpapp02
Aspnetpagelifecycle 101129103702-phpapp02
 
Parallelminds.asp.net with sp
Parallelminds.asp.net with spParallelminds.asp.net with sp
Parallelminds.asp.net with sp
 
Asp.net life cycle
Asp.net life cycleAsp.net life cycle
Asp.net life cycle
 
Asp.net control
Asp.net controlAsp.net control
Asp.net control
 
Asp dot net lifecycle in details
Asp dot net lifecycle in detailsAsp dot net lifecycle in details
Asp dot net lifecycle in details
 
Why ASP.NET Development is Important?
Why ASP.NET Development is Important?Why ASP.NET Development is Important?
Why ASP.NET Development is Important?
 
Aspnet life cycle events
Aspnet life cycle eventsAspnet life cycle events
Aspnet life cycle events
 
Page life cycle IN ASP.NET
Page life cycle IN ASP.NETPage life cycle IN ASP.NET
Page life cycle IN ASP.NET
 
Asp.net life cycle in depth
Asp.net life cycle in depthAsp.net life cycle in depth
Asp.net life cycle in depth
 
Asp.net page lifecycle
Asp.net page lifecycleAsp.net page lifecycle
Asp.net page lifecycle
 
Life cycle of web page
Life cycle of web pageLife cycle of web page
Life cycle of web page
 
Server Controls of ASP.Net
Server Controls of ASP.NetServer Controls of ASP.Net
Server Controls of ASP.Net
 
ASP.NET Page Life Cycle
ASP.NET Page Life CycleASP.NET Page Life Cycle
ASP.NET Page Life Cycle
 
Page life cycle
Page life cyclePage life cycle
Page life cycle
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
 
Dev Basics: The ASP.NET Page Life Cycle
Dev Basics: The ASP.NET Page Life CycleDev Basics: The ASP.NET Page Life Cycle
Dev Basics: The ASP.NET Page Life Cycle
 
NET_Training.pptx
NET_Training.pptxNET_Training.pptx
NET_Training.pptx
 
ASP.Net Presentation Part1
ASP.Net Presentation Part1ASP.Net Presentation Part1
ASP.Net Presentation Part1
 
Web controls
Web controlsWeb controls
Web controls
 
As pnet pagelife_usha
As pnet pagelife_ushaAs pnet pagelife_usha
As pnet pagelife_usha
 

Mehr von Abhishek Sur

Azure servicefabric
Azure servicefabricAzure servicefabric
Azure servicefabricAbhishek Sur
 
Building a bot with an intent
Building a bot with an intentBuilding a bot with an intent
Building a bot with an intentAbhishek Sur
 
C# 7.0 Hacks and Features
C# 7.0 Hacks and FeaturesC# 7.0 Hacks and Features
C# 7.0 Hacks and FeaturesAbhishek Sur
 
Angular JS, A dive to concepts
Angular JS, A dive to conceptsAngular JS, A dive to concepts
Angular JS, A dive to conceptsAbhishek Sur
 
Stream Analytics Service in Azure
Stream Analytics Service in AzureStream Analytics Service in Azure
Stream Analytics Service in AzureAbhishek Sur
 
Designing azure compute and storage infrastructure
Designing azure compute and storage infrastructureDesigning azure compute and storage infrastructure
Designing azure compute and storage infrastructureAbhishek Sur
 
Working with Azure Resource Manager Templates
Working with Azure Resource Manager TemplatesWorking with Azure Resource Manager Templates
Working with Azure Resource Manager TemplatesAbhishek Sur
 
F12 debugging in Ms edge
F12 debugging in Ms edgeF12 debugging in Ms edge
F12 debugging in Ms edgeAbhishek Sur
 
Mobile Services for Windows Azure
Mobile Services for Windows AzureMobile Services for Windows Azure
Mobile Services for Windows AzureAbhishek Sur
 
Service bus to build Bridges
Service bus to build BridgesService bus to build Bridges
Service bus to build BridgesAbhishek Sur
 
Windows azure pack overview
Windows azure pack overviewWindows azure pack overview
Windows azure pack overviewAbhishek Sur
 
AMicrosoft azure hyper v recovery manager overview
AMicrosoft azure hyper v recovery manager overviewAMicrosoft azure hyper v recovery manager overview
AMicrosoft azure hyper v recovery manager overviewAbhishek Sur
 
Di api di server b1 ws
Di api di server b1 wsDi api di server b1 ws
Di api di server b1 wsAbhishek Sur
 
Integrating cortana with wp8 app
Integrating cortana with wp8 appIntegrating cortana with wp8 app
Integrating cortana with wp8 appAbhishek Sur
 
Asp.net performance
Asp.net performanceAsp.net performance
Asp.net performanceAbhishek Sur
 
Introduction to XAML and its features
Introduction to XAML and its featuresIntroduction to XAML and its features
Introduction to XAML and its featuresAbhishek Sur
 
SQL Server2012 Enhancements
SQL Server2012 EnhancementsSQL Server2012 Enhancements
SQL Server2012 EnhancementsAbhishek Sur
 
Dev days Visual Studio 2012 Enhancements
Dev days Visual Studio 2012 EnhancementsDev days Visual Studio 2012 Enhancements
Dev days Visual Studio 2012 EnhancementsAbhishek Sur
 
Hidden Facts of .NET Language Gems
Hidden Facts of .NET Language GemsHidden Facts of .NET Language Gems
Hidden Facts of .NET Language GemsAbhishek Sur
 

Mehr von Abhishek Sur (20)

Azure servicefabric
Azure servicefabricAzure servicefabric
Azure servicefabric
 
Building a bot with an intent
Building a bot with an intentBuilding a bot with an intent
Building a bot with an intent
 
Code review
Code reviewCode review
Code review
 
C# 7.0 Hacks and Features
C# 7.0 Hacks and FeaturesC# 7.0 Hacks and Features
C# 7.0 Hacks and Features
 
Angular JS, A dive to concepts
Angular JS, A dive to conceptsAngular JS, A dive to concepts
Angular JS, A dive to concepts
 
Stream Analytics Service in Azure
Stream Analytics Service in AzureStream Analytics Service in Azure
Stream Analytics Service in Azure
 
Designing azure compute and storage infrastructure
Designing azure compute and storage infrastructureDesigning azure compute and storage infrastructure
Designing azure compute and storage infrastructure
 
Working with Azure Resource Manager Templates
Working with Azure Resource Manager TemplatesWorking with Azure Resource Manager Templates
Working with Azure Resource Manager Templates
 
F12 debugging in Ms edge
F12 debugging in Ms edgeF12 debugging in Ms edge
F12 debugging in Ms edge
 
Mobile Services for Windows Azure
Mobile Services for Windows AzureMobile Services for Windows Azure
Mobile Services for Windows Azure
 
Service bus to build Bridges
Service bus to build BridgesService bus to build Bridges
Service bus to build Bridges
 
Windows azure pack overview
Windows azure pack overviewWindows azure pack overview
Windows azure pack overview
 
AMicrosoft azure hyper v recovery manager overview
AMicrosoft azure hyper v recovery manager overviewAMicrosoft azure hyper v recovery manager overview
AMicrosoft azure hyper v recovery manager overview
 
Di api di server b1 ws
Di api di server b1 wsDi api di server b1 ws
Di api di server b1 ws
 
Integrating cortana with wp8 app
Integrating cortana with wp8 appIntegrating cortana with wp8 app
Integrating cortana with wp8 app
 
Asp.net performance
Asp.net performanceAsp.net performance
Asp.net performance
 
Introduction to XAML and its features
Introduction to XAML and its featuresIntroduction to XAML and its features
Introduction to XAML and its features
 
SQL Server2012 Enhancements
SQL Server2012 EnhancementsSQL Server2012 Enhancements
SQL Server2012 Enhancements
 
Dev days Visual Studio 2012 Enhancements
Dev days Visual Studio 2012 EnhancementsDev days Visual Studio 2012 Enhancements
Dev days Visual Studio 2012 Enhancements
 
Hidden Facts of .NET Language Gems
Hidden Facts of .NET Language GemsHidden Facts of .NET Language Gems
Hidden Facts of .NET Language Gems
 

Kürzlich hochgeladen

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 

Kürzlich hochgeladen (20)

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 

ASP.NET Page Life Cycle

  • 1. Presented By : Abhishek Sur http://www.abhisheksur.com/
  • 2. Table of Content  Introduction  Application Life Cycle  IIS Request Process  Application Pool  Worker Process  HTTP Handler/Module  ASP.NET Page Life Cycle  Page Life Cycle Steps  Page Life Cycle Events  Life Cycle for Master Page and User Control  QA
  • 3. Introduction  When Clients request for an aspx page from browser and lot of stuffs happens in background to produce the output or sending response to client. This evolves ASP.NET Page Lifecycle.  ASP.NET Page Life Cycle is very much important to know for each and every developer to developed an ASP.NET Web Application.  All events, data processing, dynamic control creation, view state, postback, rendering etc. are depends with Page Life Cycle.
  • 4. Application Life Cycle 1. Client Request For Information 2. Request comes to Server 3. Server Process the request 4. Send the response back to Client
  • 5. Application Life Cycle - Contd.  Key terms to remember  HTTP.SYS  WAS  Application Pool  Worker Process http://blogs.thesitedoctor.co.uk/tim/2006/06/30/Complete+Lifecycle+Of+A n+ASPNet+Page+And+Controls.aspx
  • 6. Application Life Cycle – Contd.  Key Terms To Remember  Http Module  Http Handler  Http Pipeline
  • 7. End Of Application Life Cycle – Start Page Life Cycle  Request Passes Through HTTP Pipe Line  This Start Page Life Cycle
  • 8. ASP.NET Page Life Cycle Begins  Start  Initialization  Load  Validation  Events  Render S I L VER
  • 9. Page Life Cycle - Start  Client Request For Resource  Request Comes To Server (IIS)  IIS Process the Initial Processing  Request Passed through HTTP- Pipe Line  ASP.NET Page Life Cycle Starts
  • 10. Page Life Cycle - Initialization  Set Postback properties  Unique ID for Each Control in the Page  Themes needs to be initialized  Dynamic control need to be created
  • 11. Page Life Cycle - Load  If the Request is the post back request then it loads data from View States and Control State
  • 12. Page Life Cycle - Validation  Validate the pages Control  Updates the IsValid property
  • 13. Page Life Cycle - Events  This will only fired if the request is an postback event.  Like, if the post back is happened for an Button Click. Button Click event will fired.
  • 14. Page Life Cycle - Render  Before Rendering All View State data has been set.  Render() method for all control has been called and write the out put on output stream.
  • 15. Page Life Cycle - Events http://msdn.microsoft.com/en-us/library/ms178472.aspx
  • 16. ASP.NET Page Life Cycle Events  PreInit  Init  PreLoad  Load  Control Events  PreRender  SaveViewState  Render  Unload
  • 17. Page Life Cycle – Events  PreInit()  This is the first event which raised in asp.net page lifecycle  Check for Request is for Post Back or not.  All dynamic control need to be created  Theme Change, Master Page Set at runtime  Init()  Raised after all controls have been initialized  Build up a tree of controls from the ASPX file  Turn on view state monitoring – any changes in control will be tracked by View State for future.
  • 18. Page Life Cycle - Events  PreLoad()  Load view state data for page and controls  Load Postback data if needed  We can process any kind operation that need to perform before page load  Load()  OnLoad methods control called for each and every control  We can create the connection initialization for any kind of external source like database connection  We can also set the control properties
  • 19. Page Life Cycle - Events  Control Events  If this is an postback request , Corresponding events will triggered. Like, if the post back is happing for button click, then Button_Click Event will fired.  PreRender  Each control of the page has a PreRender event which is being invoked.  EnsureChildControls is also being called during this events  DataBind method for all control has also been called  If we want to change any thing to any control this is the last event where we can do because after the pageRender starts
  • 20. Page Life Cycle - Events  SaveViewState  ViewState Monitoring is turned off as here all the ViewState Data need to be saved.  View State data saved in hidden filed called _VIEWSTATE  Render  Pages calls the Render method for each and every control.  Text writer that writes the output to the as output stream  Output steam set to the page's Response property.
  • 21. Page Life Cycle - Events  Unload  This is the last event of asp.net page life cycle  This ensure the Request and Response has been set to null.  This is called only after the content of the page fully rendered and response sent to client
  • 22. Page Life Cycle - Master Page and User Controls  MasterPage gets initialized from the Page class in the init phaze of page. The content of Masterpage gets loaded side by side as the page gets loaded.  User control will be initialized and added to the page and before page gets initialized  After page Onload, MasterPage_OnLoad gets called and UserControl_Onload gets called sequentially.  Followed by each of Page events, masterPage events gets called and next Usercontrol events are called.  During the unload phaze, Usercontrol gets unloaded first and then masterpage and Page in sequence.  For further reference refer to : http://blogs.thesitedoctor.co.uk/tim/2006/06/30/Complete+Life cycle+Of+An+ASPNet+Page+And+Controls.aspx
  • 23. Q/A