Download presentation
Presentation is loading. Please wait.
Published byPeregrine McCormick Modified over 9 years ago
2
Nicholas Goossens R&D Lead Open Box Software Session Code: WUX302
3
How does it work?
4
Classic ASP ASP.Net Authentication Page Lifecycle AJAX Controls.aspx.ashx Handlers User Controls Custom Controls Browser Targeting Doc Types Services Master Pages Client Script Request Response Parsing
5
Agenda ASP from Then till Now Buzzwords Request-to-Response Walkthrough ASP.Net Extras Summary
6
Classic ASP Interpreted language Included embedded scripting code mixed into HTML Limited to VBScript Ran in the same process as IIS Inherently not scalable (needed MTS)
8
ASP.Net Beginnings Designed by Scott Guthrie & Mark Anders Originally known as XSP Not.NET-related – Java based ! Became ASP+ with the design of the CLR Rewritten in C# Renamed when.NET branding introduced
9
What is ASP.Net A framework for developing and delivering information & applications on the web. Known primarily as a page framework. A complete Request/Response management system. Can handle and respond to all sorts of requests on the Internet (or an Intranet).
10
Characteristics of ASP.NET Runs under its own worker process. No longer tied to IIS. Code execution managed by CLR. Code-Behind model allows code separation. Includes state handling facilities. Provides caching functionality.
11
Commonly Used Terms Request HTTP query from client to server Response Data stream send from server to client ASP.Net Pipeline A series of extensible functionality points which continue the process of a request in order to eventually obtain a response. Page Lifecycle Another series of functionality points that form the process of converting an ASPX page to HTML output. The entire page lifecycle occurs between two pipeline points.
12
Request-to-Response Black Box
13
Request-to-Response Desktop Browser http://www.microsoft.com/default.aspx Black Box - Web Server (IIS) Rendered HTML
14
Getting to.NET http.syshttp.sys aspnet_isapi.dll (unmanaged) Web Server (IIS) Worker Process (Per App Pool) App Domain (Per VD) ISAPIRuntime (Managed) http://www.asp.net/ Pipeline Kicked Off
15
ASP.NET Takes Over HttpRuntime.ProcessRequest HttpContext created. This serves as an entry point into the request, response, and other accessible variables. An HttpApplication instance is created. HttpApplication Init method starts pipeline processing.
16
Request Initialization
17
ASP.Net Pipeline HttpApplication BuildSteps Event Processing Checks Hooks from Global.asax Checks hooks from HTTP Modules URL-Rewriting Authentication - HttpContext.Current.User Caching Kick off Page Lifecycle HttpApplication BeginRequest AuthenticateRequest / Post AuthorizeRequest / Post ResolveRequestCache / Post MapRequestHandler / Post AcquireRequestState / Post PreRequestHandlerExecute / Post ReleaseRequestState / Post UpdateRequestCache / Post LogRequest / Post EndRequest PreSendRequestHeaders PreSendRequestContent
18
ASP.Net Pipeline
19
HTTP Modules Classes that implement IHttpModule. MyModule : IHttpModule
20
ASP.NET HTTP Modules of Interest WindowsAuthenticationModule FormsAuthenticationModule UrlAuthenticationModule FileAuthorizationModule ServiceModel SessionStateModule OutputCacheModule
21
ASP.Net Modules
22
Where the magic happens HttpApplication BeginRequest AuthenticateRequest / Post AuthorizeRequest / Post ResolveRequestCache / Post MapRequestHandler / Post AcquireRequestState / Post PreRequestHandlerExecute / Post ReleaseRequestState / Post UpdateRequestCache / Post LogRequest / Post EndRequest PreSendRequestHeaders PreSendRequestContent PreRequestHandlerExecute / Post
23
HTTP Handlers Classes that implement IHttpHandler. MyHandler : IHttpHandler
24
HTTP Handler Factories Can also implement IHttpHandlerFactory. MyHandlerFactory : IHttpHandlerFactory
25
Handler Installation Any level in the Config chain Handler factory that returns and executes the handler that will convert an ASPX page to HTML output.
26
Handlers
27
The PageHandlerFactory Class Implements IHttpHandlerFactory. GetHandler method returns an IHttpHandler in the form of System.Web.UI.Page-derived class hierarchy. Page class implements IHttpHandler. Page class inherits from Control. Control contains events/methods for the “Page Event Lifecycle”. PageHandlerFactory creates a class structure out of your request.
28
Anonymous Class Created from ASPX content Determines language to be used to generate page-gen class. Specifies the partial class to serve as the code- behind. Optional: Name of the code- file for Visual Studio.
29
Anonymous Class Created from ASPX content LiteralControl Converted to instances of System.Web.UI.LiteralControl that are added to the control tree of this class. Remember, this class will ultimately inherit from System.Web.UI.Control
30
Anonymous Class Created from ASPX content LiteralControl Program code directly added to generated class.
31
Anonymous Class Created from ASPX content LiteralControl Converted to instances of the corresponding server control class for each of these control tags, that will be added to the control tree of this class. The Form control instance is placed directly in the control tree of the class being created; while the TextBox and Label controls are added to the control tree of the Form control.
32
Anonymous Class Created from ASPX content LiteralControl __PAGE System.Web.UI.Page ctrl0 System.Web.UI.LiteralControl Function Code ctrl1 System.Web.UI.LiteralControl form1 System.Web.UI.HtmlControls.HtmlForm ctrl2 System.Web.UI.LiteralControl TextBox1 System.Web.UI.WebControls.TextBox ctrl3 System.Web.UI.LiteralControl Label1 System.Web.UI.WebControls.Label ctrl4 System.Web.UI.LiteralControl ctrl5 System.Web.UI.LiteralControl Remember: this class “ultimately” inherits from System.Web.UI.Page Control IDs
33
Anonymous Class Created from ASPX content LiteralControl
34
Page Class Generation
35
Anonymous Class Creation
36
Page (Control) Lifecycle PreInit Init InitComplete CreateChildControls (IsPostBack) LoadViewState/LoadControlState IPostBackDataHandler.LoadPostData PreLoad Load IPostBackDataHandler.RaisePostBackChangedEvent IPostBackEventHandler.RaisePostBackEvent LoadComplete CreateChildControls (!IsPostBack) PreRender DataBind PreRenderComplete SaveViewState/SaveControlState Render Unload Complete List
37
Control Rendering Activated through the Control class’ Render method. Each control is designed to output something to the response buffer. Most controls output HTML. Some controls contain others in their tree. Control rendering involves recursively rendering child controls. Controls don’t need to output anything ScriptManager
38
Getting a Response “Rendering” uses an HtmlTextWriter stored in the Response object. Response object is part of HttpContext. Writer sent into Render method. After pipeline complete, contents returned up the chain to aspnet_isapi.dll then http.sys. Results viewed on browser.
39
Extras Postbacks ASCX User Controls Master Pages ASHX Handlers Themes & Skins AJAX MVC
40
Process Summary IISIIS Worker Process Pipeline (Modules) Lifecycle (Handlers) Render (Response)
41
What To Take Away From This ASP.NET does much more than serve pages Decoupled architecture allows flexible hosting Pipeline and Page Life cycle – two different things Extensible architecture allows opportunities for interception and alteration Module and Handler do the work Be mindful of how much is happening behind the scenes
42
Resources How ASP.NET Works http://www.west- wind.com/presentations/howaspnetworks/howasp networks.asp ASP.NET Page Class Overview http://msdn.microsoft.com/en- us/library/ms178138.aspx IIS and the Process Model http://dotnetslackers.com/articles/iis/ASPNETInter nalsIISAndTheProcessModel.aspx
44
www.microsoft.com/teched International Content & Community http://microsoft.com/technet Resources for IT Professionals http://microsoft.com/msdn Resources for Developers www.microsoft.com/learning Microsoft Certification & Training Resources Resources Required Slide Speakers, TechEd 2009 is not producing a DVD. Please announce that attendees can access session recordings from Tech-Ed website. These will only be available after the event. Required Slide Speakers, TechEd 2009 is not producing a DVD. Please announce that attendees can access session recordings from Tech-Ed website. These will only be available after the event. Tech ·Ed Africa 2009 sessions will be made available for download the week after the event from: www.tech-ed.co.zawww.tech-ed.co.za
45
Related Content WUX306 - Taking AJAX to the Next Level WUX07-HOL - Diagnosing and Troubleshooting Web Applications in Internet Information Services (IIS) 7.0 AZP04-HOL - Building Windows Azure Services DAT01-HOL - Application Development for Microsoft SQL Server 2008: Let's Write Some Code! Required Slide Speakers, please list the Breakout Sessions, TLC Interactive Theaters and Labs that are related to your session. Any queries, please check with your Track Owner. Required Slide Speakers, please list the Breakout Sessions, TLC Interactive Theaters and Labs that are related to your session. Any queries, please check with your Track Owner.
46
Required Slide Complete a session evaluation and enter to win! 10 pairs of MP3 sunglasses to be won
47
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. Required Slide
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.