Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 ASP.NET Internals +972-52-3030304.

Similar presentations


Presentation on theme: "1 ASP.NET Internals +972-52-3030304."— Presentation transcript:

1 1 ASP.NET Internals Dan.Amiga@develop.com +972-52-3030304

2 2 Disclaimer

3 3 Game plan Understanding and utilizing ASP.NET Goal: Leave you with a solid end-to-end understanding the ASP.NET Pipeline

4 4 W3WP.EXE W3WP.EXE ASP.NET ISAPI ASP.NET ISAPI AppDomain AppDomain HttpApplication HttpApplication PageHandlerFactory PageHandlerFactory PageHandler PageHandler HttpApplicationFactory HttpApplicationFactory e e e e HttpModule HttpModule HttpContext HttpRuntime HttpRuntime http.sys http.sys HTTP CONENT

5 5 Dynamic web content Dynamic content over a stateless protocol Dynamically generated HTML requires server host and a supporting engine Engines include: CGI,ISAPI,ASP,ASP.NET ASP.NET custom host: – Cassini, VS Development server.

6 6

7 7 ASP.NET on IIS 6.0 IIS6 – AppPool model – Limited customization ASP.NET – ISAPI Extension – Only processes ASP.NET requests

8 8 ASP.NET on IIS 7.0 ASP.NET Modes: – ISAPI mode (compat) – Integrated mode ASP.NET HttpModules plug directly into server HttpModules or Global.asax events can run code on all requests VB and C# code can be easily used to customize and extend the server

9 9.NET Runtime host What is a.NET runtime host? What does it mean to be a runtime host? Who can be a runtime host?

10 10 W3WP.EXE.NET Runtime & ASP.NET http.sys SQL Server.NET Runtime Window Application.NET runtime and ASP.NET Everyone can be.NET Runtime host & ASP.NET host

11 11 ASP.NET runtime ASP.NET is an extensible HTTP processing architecture – System.Web.Hosting.ISAPIRuntime – HttpRuntime – for host interaction – HttpApplication – for managing requests – HttpContext – ECB a like; Request,Response,Session,Cache,User

12 12 AppDomain Pool HttpApplicationFactory HttpRuntime ASP.NET Runtime HttpApplication Request from host HttpContext HttpApplication HttpContext

13 13 Handlers Code that responds to a request for a specific URL – Responsible for generating HTTP response Implement IHttpHandler ASPX pages implement IHttpHandler Asynchronous Handlers

14 14 HttpApplication Http Handler BeginRequest() AuthenticateRequest() AuthorizeRequest() ResolveRequestCache() AcquireRequestState() PreRequestHandlerExecute() EndRequest() UpdateRequestCache() ReleaseRequestState() PostRequestHandlerExecute() HttpModule IHttpHandler Init

15 15 Worker thread pool Handler BeginProcessRequest(AsyncCallBack cb) EndProcessRequest() Async I/O cb() Stream IO thread pool EndRead() HttpApplication QueueUserWorkItem BeginRead(cb) Asynchornous Handlers

16 16 Handler factories Allows custom initialization of handlers – Used by ASP.NET to demand compile pages Implement IHttpHandlerFactory Great extensibility mechanism – Combined with PageParser Examples – PageHandlerFactory (VirtualPath) – HttpRemotingHandlerFactory – WebServiceHandlerFactory (syncSessionHandler)

17 17 HttpApplication PageHandlerFactory PageHandler1 PageHandler2

18 18 Virtual Path Providers Processing requests requires an endpoint – typically endpoint is ASPX from the file system Virtual path providers allow virtualization of file system – allows for alternate store of pages or any file – typical use is DB store for website files and/or content Must provide classes that represents files or directories

19 19 HttpApplication PageHandlerFactory PageHandler1 PageHandler2 Virtual Path Providers

20 20 HttpModules Handle events for pre/post processing – Before & After handler is executed Always executes with HttpContext in scope – Can choose to halt request processing

21 21 HttpApplication HTTP Modules BeginRequest() AuthenticateRequest() AuthorizeRequest() ResolveRequestCache() AcquireRequestState() PreRequestHandlerExecute() EndRequest() UpdateRequestCache() ReleaseRequestState() PostRequestHandlerExecute() HttpModule PageHandler/Factory Init HttpContext

22 22 W3WP.EXE W3WP.EXE ASP.NET ISAPI ASP.NET ISAPI AppDomain AppDomain HttpApplication HttpApplication PageHandlerFactory PageHandlerFactory PageHandler PageHandler HttpApplicationFactory HttpApplicationFactory e e e e HttpModule HttpModule HttpContext HttpRuntime HttpRuntime http.sys http.sys HTTP CONENT The entire HTTP Pipeline Summary

23 23 ASP.NET Internals Dan.Amiga@develop.com +972-52-3030304

24 24 ASP.NET Internals Dan Amiga Senior Consultant, Advantech Instructor, DevelopMentor http://blogs.microsoft.co.il/amiga dan@advantech.co.il Dan.amiga@develop.com

25 25 Compilation Explain page compilation Demand compilation BuildProviders CompilationMode Never – No code but – Eval,Bind,ExpressionBuilders apply

26 26 Build Providers

27 27 ASPX Page Markup ASPX Page Markup Partial class files compiled into a single class Framework Generated file Framework Generated file Your code behind System.Web.UI.Page


Download ppt "1 ASP.NET Internals +972-52-3030304."

Similar presentations


Ads by Google