Harish Understanding Aspnet


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide.
  • If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide.
  • If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide.
  • If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide.
  • If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide.
  • Harish Understanding Aspnet

    1. 1. Harish Ranganathan Application Platform Evangelist Microsoft India
    2. 2. AGENDA • HTTP Runtime • HTTP Context • IIS & ASP.NET Relation • Global.asax • HTTP Modules • Page Framework • HTTP Handlers • Best Practices
    3. 3. HTTP Runtime • A low-level HTTP processing infrastructure • Logical replacement for ISAPI filters/extensions • Ability to add, replace, or remove core pieces of the product • Benefits: Built-in thread pool, asynchronous support, access to ASP.NET intrinsic objects
    4. 4. HTTP Runtime
    5. 5. Http Runtime
    6. 6. IIS-ASP.NET Relation w3wp.exe (IIS 6.0) http.sys (Kernel Mode)
    7. 7. IIS-ASP.NET Relation Document types are mapped to ISAPI extensions in the IIS Manager
    8. 8. IIS – ASP.NET Relation
    9. 9. HTTP Pipeline HTTP IIS aspnet_isapi HttpModules HttpHandler Request
    10. 10. HTTP Modules • Called before and after the handler executes • Ability to intercept, participate or modify each individual request into an application Ex: Changing URL in request/response to hide server names behind firewall. • The HTTP Application provides several events that modules can synchronize with
    11. 11. HTTP Modules • Global Application Events: – Start – End • Per request events (in order): – BeginRequest – PreRequestHandlerExecute – AuthenticateRequest – PostRequestHandlerExecute – AuthorizeRequest – ReleaseRequestState – ResolveRequestCache – UpdateRequestCache – AcquireRequestState – EndRequest • Per request events (non-deterministic): – PreSendRequestHeaders – PreSendRequestContent – Error
    12. 12. HTTP Modules Built-In HTTP Modules: • Authentication Modules • Authorization Modules • OutputCache Module • SessionState Module • Configuring HTTP Modules – Use httpModules section handler • View the Machine.Config
    13. 13. HTTP Handlers • Handlers: – Are the endpoint in the request process – Only one handler is invoked per request • Examples – ASP.NET Page Handler: • Implements the ASP.NET Page Framework • Processes all requests for .aspx pages – ASP.NET Service Handler: • Implements Web Services • Processes all requests for .asmx pages • Configuring HTTP Handlers
    14. 14. HTTP Handlers & Modules
    15. 15. HTTP Context • Encapsulates all information about an individual HTTP request • ASP.NET intrinsic objects are exposed as properties of the HttpContext • Modules and Handlers get a reference to an HttpContext object representing the current request • Flows through the lifetime of a request
    16. 16. HTTP Context • ASP.NET supports all ASP classic members Property Managed Class – Request HttpRequest – Response HttpResponse – Server HttpServerUtility – Session HttpSessionState – Application HttpApplicationState • ASP.NET adds several new and useful members – Request.Files – Response.Cache – Error/User/Trace
    17. 17. Global.asax • Extends on the familiar functionality of the Global.asa • Global.asax must be located in the root of a Web application • Enables easy handling of Application level events without a custom HttpModule
    18. 18. Global.asax Updates: • Are automatically detected • Causes the Global.asax to be recompiled • Restarts the HTTP Application • ASP.NET completes all current requests before shutting down old application • Fires Application_End event • Shuts down App Domain
    19. 19. HTTP Context & Global.asax
    20. 20. Page Framework • Overview • Page Object • Page Lifecycle • Page Events • Control Tree • Page Directives
    21. 21. Page Framework Page Object: • Inherits from Control, implements IHttpHandler • All .aspx pages inherit from Page • Exposes the ASP.NET intrinsics • Wires up events (Page_Load, Page_Init…)
    22. 22. Page Framework Init Page Lifecycle: LoadViewState Constructor PostBack Data Processing Load ProcessRequest (hidden from user) PostBack Change Notification PostBack Event Handling PreRender SaveViewState Render Dispose
    23. 23. Page Framework
    24. 24. Best Practices • Return Multiple Resultsets • Paged Data Access • Connection Pooling • ASP.NET Cache API • Per Request caching • Background Processing
    25. 25. Best Practices • Page Output Caching and Proxy Servers • Session State & Viewstate • Debug vs. Release • Exception Handling
    26. 26. Related Content Breakout Sessions (session codes and titles) Interactive Theater Sessions (session codes and titles) Hands-on Labs (session codes and titles) Hands-on Labs (session codes and titles)
    27. 27. Track Resources Resource 1 Resource 2 Resource 3 Resource 4
    28. 28. © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.