I'm trying to gain a better understanding of the "plumbing" behind ASP.NET and ASP.NET MVC. I've been reading this page, which has helped a lot. From what I understand so far every ASP.NET site has a class that inherits from System.Web.HttpApplication. HttpApplication then has a series of events that trigger HttpModules and HttpHandlers such as BeginRequest, AuthorizeRequest, End Request etc... The HttpModules and HttpHandlers then read and write to and from the current HttpContext.
How does ASP.NET know what HttpApplication class to use? My application has the typical MvcApplication class in a Global.asax file. But I don't see anything in this class related to MVC. Nor do I see any settings anywhere that assign this class as being the "application". Does ASP.NET just always look for a file named Global.asax to figure out what HttpApplication class to create? Or does ASP.NET just look for any class that inherits from HttpApplication in my assembly?
Also, how does it know what modules and handler to use? The page I mentioned above said you specify the handlers and modules through and settings in web.config. But my ASP.NET MVC application doesn't have these settings in its web.config?
If I set a break point in one of my action methods and check HttpContext.Current.ApplicationInstance.Modules I see the following:
OutputCache
Session
WindowsAuthentication
FormsAuthentication
PassportAuthentication
RoleManager
UrlAuthorization
FileAuthorization
AnonymousIdentification
Profile
ErrorHandlerModule
ServiceModel
UrlRoutingModule-4.0
ScriptModule-4.0
__DynamicModule_System.Web.WebPages.WebPageHttpModuleDefaultAuthentication
Where were these specified? Likewise if I check HttpContext.Current.Handler I can see that it's set to a System.Web.Mvc.MvcHandler.