Harish Understanding Aspnet
-
Upload
rsnarayanan -
Category
Technology
-
view
985 -
download
0
Transcript of Harish Understanding Aspnet
![Page 1: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/1.jpg)
![Page 2: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/2.jpg)
ASP.NET - Under the Covers
Harish RanganathanApplication Platform EvangelistMicrosoft India
![Page 3: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/3.jpg)
AGENDA
• HTTP Runtime • HTTP Context
• IIS & ASP.NET Relation
• Global.asax
• HTTP Modules • Page Framework
• HTTP Handlers • Best Practices
![Page 4: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/4.jpg)
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
![Page 5: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/5.jpg)
HTTP Runtime
![Page 7: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/7.jpg)
IIS-ASP.NET Relation
w3wp.exe (IIS 6.0)
http.sys (Kernel Mode)
![Page 8: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/8.jpg)
IIS-ASP.NET Relation
Document types are mapped to ISAPI extensions in the IIS Manager
![Page 10: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/10.jpg)
HTTP Pipeline
HTTP Request IIS aspnet_isap
iHttpModule
s HttpHandler
![Page 11: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/11.jpg)
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
![Page 12: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/12.jpg)
HTTP Modules• Global Application Events:
– Start – End
• Per request events (in order):
• Per request events (non-deterministic): – PreSendRequestHeaders– PreSendRequestContent– Error
– BeginRequest– AuthenticateRequest– AuthorizeRequest– ResolveRequestCache– AcquireRequestState
– PreRequestHandlerExecute – PostRequestHandlerExecute – ReleaseRequestState – UpdateRequestCache – EndRequest
![Page 13: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/13.jpg)
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
![Page 14: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/14.jpg)
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
![Page 16: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/16.jpg)
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
![Page 17: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/17.jpg)
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
![Page 18: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/18.jpg)
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
![Page 19: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/19.jpg)
Global.asaxUpdates:
• 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
![Page 21: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/21.jpg)
Page Framework
• Overview
• Page Object
• Page Lifecycle
• Page Events
• Control Tree
• Page Directives
![Page 22: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/22.jpg)
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…)
![Page 23: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/23.jpg)
Page Framework
Page Lifecycle:
Constructor PostBack Data Processing
ProcessRequest (hidden from user)
I nit
Render
PreRender
Dispose
PostBack Event Handling
Load
PostBack Change Notification
LoadViewState
SaveViewState
![Page 25: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/25.jpg)
Best Practices
• Return Multiple Resultsets
• Paged Data Access
• Connection Pooling
• ASP.NET Cache API
• Per Request caching
• Background Processing
![Page 26: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/26.jpg)
Best Practices
• Page Output Caching and Proxy Servers
• Session State & Viewstate
• Debug vs. Release
• Exception Handling
![Page 27: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/27.jpg)
धन्यवा�दઆભા�ર ধন্য�বা�দ
ਧੰ�ਨਵਾ�ਦ
ଧନ୍ୟ�ବା�ଦ
நன்றி�
ధన్య�వాదాలు� ಧನ್ಯ�ವಾ�ದಗಳು
നി�ങ്ങള്ക്ക്� നിന്ദി�
![Page 29: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/29.jpg)
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)
![Page 30: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/30.jpg)
Track Resources
Resource 1
Resource 2
Resource 3
Resource 4
![Page 31: Harish Understanding Aspnet](https://reader036.fdocuments.net/reader036/viewer/2022062512/55497fbfb4c90554648b4869/html5/thumbnails/31.jpg)
© 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.