Académique Documents
Professionnel Documents
Culture Documents
Sreedhar Koganti
Microsoft MVP (ASP.NET)
http://weblogs.asp.net/skoganti
Contact: http://weblogs.asp.net/skoganti/contact.aspx
--- http://www.w3coder.com
Agenda
Request Process Pipeline architecture intro
Good to know HttpRuntime Architecture
Meet Global.asax, HttpModule
Take advantage of HttpModule
Understand HttpHandler
Meet Lengthy process Life saver Asynchronous
HttpHandler
Q&A
Request Process Pipeline
architecture intro
Worker
Workerprocess
processidentity
identity (w3wp.exe)
(w3wp.exe)
CLR/HttpRuntime
CLR/HttpRuntime
aspnet_isapi
aspnet_isapi
AppDomain
User Mode
Kernel Mode
HTTP.SYS
HTTP.SYS
CodeCamp/Pipelinetest.aspx
IIS and ASP.NET
.NET extensions are configured to be handled by
aspnet_isapi.dll
Peal it and see inside the
pipeline
Good to know HttpRuntime Architecture
HttpHandlers
HttpRuntime
SessionState
HttpContext
Authentication
OutputCache
HttpModules
Process Boundary
CodeCamp/Pipelinetest.aspx
Good to know HttpRuntime Architecture
Demo
Per-Request Application Events
BeginRequest
AuthenticateRequest
AuthorizeRequest
ResolveRequestCache
AquireRequestState
PreRequestHandlerExecute
Target Handler Execution
PostRequestHandlerExecute
ReleaseRequestState
UpdateRequestCache
EndRequest
Take advantage of HttpModule
Class must implement interface:
System.Web.IHttpModule
public interface IHttpModule {
public void Init(HttpApplication application);
public void Dispose();
}
Init()
Called when module is created
Register delegates for runtime events
Dispose()
Registering an HttpModule
Compile into .NET assembly
Deploy
Into application’s \bin directory or
Register in the GAC
Register in configuration:
<configuration>
<system.web>
<httpModules>
<add name=“friendly name”
type=“class, assembly“ />
</httpModules>
</system.web>
</configuration>
Real-time HttpModule
examples
Demo
Understand HttpHandler
Are the endpoint for a request
They are responsible for creating the Http response that is
send back to client
Handlers are similar to ISAPI Extensions
Examples:
ASP.NET Page Handler (*.aspx)
ASP.NET Service Handler (*.asmx)
Server-Side XSL Transformer (*.xml)
Creating an HttpHandler
Class must implement interface:
System.Web.IHttpHandler
public interface IHttpHandler {
public void ProcessRequest(HttpContext context);
public bool IsReusable();
}
ProcessRequest()
‘Main’ method of the handler
IsReusable { get; }
Indicates whether pooling is supported
Registering an HttpHandler
Compile into .NET assembly
Deploy
Into application’s \bin directory or
Register in the GAC
Register in configuration:
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path=“Assembly.FileExtension"
Demo
Meet Lengthy process Life saver
Asynchronous HttpHandler
}
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{}
}
Real-time IHttpAsyncHandler
examples
Demo
It’s Your time….
Want to learn more? here are some references..
Have Questions: Visit http://forums.asp.net/