Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Asp.NET Handlers and Modules

3,852 views

Published on

Basic understanding of ASP.NET HANDLERS and MODULES

Published in: Education, Technology
  • Be the first to comment

Asp.NET Handlers and Modules

  1. 1. ASP.NETHandlers & Modules Session Time: 30-45minutes By: Sunil Pottumuttu
  2. 2. Agenda• Introduction• The Problem• Extension Based Preprocessor• Event Based Preprocessor• Overall Picture• Steps to Implement• The Final Output
  3. 3. IIS & ASP.NETRequest Workflow IIS IIS Application *.asmx aspnet_isapi.dll HTTP Machine.config Web.config Request *.asp asp.dll HTTP Process Request Response
  4. 4. 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
  5. 5. Machine.config Overrides Web.config<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> <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>
  6. 6. HttpHandler - The ExtensionBased Preprocessor
  7. 7. HttpModule - Event BasedPreprocessor
  8. 8. Hook to the Events
  9. 9. Overall Picture
  10. 10. Some Handlers
  11. 11. IIS 7 – Handler Mappings & Demo
  12. 12. IIS 7 – Http Modules & Demo
  13. 13. 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
  14. 14. 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
  15. 15. 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
  16. 16. Imp Http Modules Events• BeginRequest• AuthenticateRequest• AuthorizeRequest• EndRequest• Error
  17. 17. Demo Material

×