Conclusion


Conclusion

In this chapter, we saw how the ASP.NET architecture includes a rendezvous point for all the requests passing through an application. This is especially important in Web applications composed of disparate components centered around a pipeline. While there are certain obvious places where a request context can show up (most notably in the end handler), it's clear that there are other points in the request chain where you need to have something to hold on to.

ASP.NET offers two broad choices in implementing such a “global space.” Global.asax is a convenient representation of the HttpApplication object. ASP.NET applications have a singular instance of the HttpApplication class. The application object includes a handy dictionary in which to store data that needs to survive and be available from all points within the application. In addition, Global.asax offers a place to intercept various application-wide events.

HTTP Modules offer very much the same functionality, although in a different package. HTTP Modules implement the IHttpModule interface and are deployed with the application via the Web.Config file. When an application starts up, the ASP.NET runtime looks in the Web.Config file to see if any additional handlers need to be attached to the pipeline. (ASP.NET plugs in a number of Modules already—they implement such features as authentication and session state.) When ASP.NET sees a new Module within the Web.Config file, ASP.NET loads the Module and calls the Init method. Modules usually initialize by setting up handlers for various application-wide events.




Microsoft ASP. NET 2.0 Programming Step by Step
Microsoft ASP.NET 2.0 Step By Step (Step By Step (Microsoft))
ISBN: B002KE5VYO
EAN: N/A
Year: 2005
Pages: 177

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net