ASP'NET Internals - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

ASP'NET Internals

Description:

Engines include: CGI,ISAPI,ASP,ASP.NET. ASP.NET custom host: Cassini, VS Development server. ... System.Web.Hosting.ISAPIRuntime. HttpRuntime for host interaction ... – PowerPoint PPT presentation

Number of Views:145
Avg rating:3.0/5.0
Slides: 28
Provided by: downloadM
Category:
Tags: asp | net | asp | hosting | internals | net | web

less

Transcript and Presenter's Notes

Title: ASP'NET Internals


1
ASP.NET Internals
Dan.Amiga_at_develop.com 972-52-3030304
2
Disclaimer
3
Game plan
  • Understanding and utilizing ASP.NET
  • Goal Leave you with a solid end-to-end
    understanding the ASP.NET Pipeline

4
W3WP.EXE
ASP.NET ISAPI
http.sys
AppDomain
HttpRuntime
HTTP
CONENT
HttpApplicationFactory
HttpApplication
HttpContext
e
e
HttpModule
PageHandlerFactory
PageHandler
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
(No Transcript)
7
ASP.NET on IIS 6.0
  • IIS6
  • AppPool model
  • Limited customization
  • ASP.NET
  • ISAPI Extension
  • Only processes ASP.NET requests

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
.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
W3WP.EXE
http.sys
.NET Runtime ASP.NET
SQL Server
.NET Runtime
Window Application
.NET runtime and ASP.NET
Everyone can be .NET Runtime host ASP.NET host
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
Request from host
AppDomain
Pool
HttpRuntime
HttpApplication
HttpApplication
HttpApplication
HttpApplication
HttpApplication
HttpApplicationFactory
HttpApplication
HttpContext
HttpContext
ASP.NET Runtime
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
Http Handler
BeginRequest()
HttpApplication
AuthenticateRequest()
Init
AuthorizeRequest()
HttpModule
HttpModule
ResolveRequestCache()
HttpModule
AcquireRequestState()
HttpModule
HttpModule
PreRequestHandlerExecute()
HttpModule
HttpModule
PostRequestHandlerExecute()
HttpModule
ReleaseRequestState()
UpdateRequestCache()
EndRequest()
IHttpHandler
15
Asynchornous Handlers
Worker thread pool
QueueUserWorkItem
IO thread pool
HttpApplication
cb()
EndProcessRequest()
Async I/O
EndRead()
Stream
BeginProcessRequest(AsyncCallBack cb)
BeginRead(cb)
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
HttpApplication
PageHandlerFactory
PageHandler1
PageHandler2
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
HttpApplication
Virtual Path Providers
Virtual Path Providers
Virtual Path Providers
Virtual Path Providers
PageHandlerFactory
PageHandler1
PageHandler2
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
HTTP Modules
HttpContext
BeginRequest()
HttpApplication
AuthenticateRequest()
Init
AuthorizeRequest()
HttpModule
HttpModule
ResolveRequestCache()
HttpModule
AcquireRequestState()
HttpModule
HttpModule
PreRequestHandlerExecute()
HttpModule
HttpModule
PostRequestHandlerExecute()
HttpModule
ReleaseRequestState()
UpdateRequestCache()
EndRequest()
PageHandler/Factory
22
Summary
W3WP.EXE
ASP.NET ISAPI
http.sys
AppDomain
HttpRuntime
HTTP
CONENT
HttpApplicationFactory
HttpApplication
HttpContext
e
e
HttpModule
PageHandlerFactory
PageHandler
The entire HTTP Pipeline
23
ASP.NET Internals
Dan.Amiga_at_develop.com 972-52-3030304
24
ASP.NET Internals
Dan Amiga Senior Consultant, Advantech Instructor,
DevelopMentor http//blogs.microsoft.co.il/amiga
dan_at_advantech.co.il Dan.amiga_at_develop.com
25
Compilation
  • Explain page compilation
  • Demand compilation
  • BuildProviders
  • CompilationMode Never
  • No code but Eval,Bind,ExpressionBuilders apply

26
Build Providers
27
System.Web.UI.Page
Partial class files compiled into a single class
Framework Generated file
Your code behind
ASPX Page Markup
Write a Comment
User Comments (0)
About PowerShow.com