Upload
pysunil
View
3.201
Download
7
Tags:
Embed Size (px)
DESCRIPTION
Basic understanding of ASP.NET HANDLERS and MODULES
Citation preview
ASP.NETHandlers & Modules
Session Time: 30-45minutes
By: Sunil Pottumuttu
Agenda
• Introduction• The Problem• Extension Based Preprocessor• Event Based Preprocessor• Overall Picture • Steps to Implement• The Final Output
IIS & ASP.NETRequest Workflow
Application
HTTPResponse
asp.dll
aspnet_isapi.dll
*.asp
*.asmx
HTTPRequest
Process Request
Web.configMachine.config
IISIIS
ASP.NET Configuration
• Machine.config defines default handlers or handler factories to manage requests
• Web.config may alter Machine.config settings at the application level
Machine.config Overrides Web.config
<httpHandlers> <add verb=“GET" path="*.xml" type=“DotNetDashboard.Web.FileDownloadHandler, DotNetDashboard.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxx"/> <add verb="*" path=“displayImage.aspx" type=“DotNetDashboard.Web.ImageFormatter, DotNetDashboard.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxx” /> <add verb="*" path=“*.xls” type="System.Web.HttpForbiddenHandler"/></httpHandlers>
<httpHandlers> <add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory"/> <add verb="*" path="*.asmx" type="System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services, …/><add verb="*" path="*.soap" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory,
System.Runtime.Remoting, …/> <add verb="*" path="*.config" type="System.Web.HttpForbiddenHandler"/></httpHandlers>
HttpHandler - The Extension Based Preprocessor
HttpModule - Event Based Preprocessor
Hook to the Events
Overall Picture
Some Handlers
IIS 7 – Handler Mappings & Demo
IIS 7 – Http Modules & Demo
Synchronous vs Asnchronous• synchronous request, the
ProcessRequest method is executed, and any markup produced is sent to the browser once the entire request is processed• BeginProcessRequest and the
EndProcessRequest
Virtual File Provider
• Global.asax provides hooks into the events of the ASP.NET pipeline just like an httpModule
• Global.asax provides is the capability to add handlers to events not available to modules, like Session_Start and Session_End.
• httpModules have over Global. asax is the ability to compile modules into class libraries that can be used in multiple ASP.NET web sites
Modules vs Global.asax
• synchronous request, the ProcessRequest method is executed, and any markup produced is sent to the browser once the entire request is processed• BeginProcessRequest and the
EndProcessRequest
Imp Http Modules Events
• BeginRequest • AuthenticateRequest • AuthorizeRequest • EndRequest • Error
Demo Material
Demo Material