Concepts and interaction between IIS and ASP.NET components can be confusing at times. Relationships amongst IIS application, virtual directory, application pool, application domain are confusing at best. Having researched a bit, I attempted to model the various concepts and their inter-relationships using the following UML class diagram.
Concepts in Pink applies strictly to ASP.NET domain.
Concepts in Blue are applicable to IIS domain.
A point to note is that a VirtualDirectory (VD) can contain other VDs. If a composed/ sub VD is not configured as an Application, the VD is treated as a sub-directory of the composing/ parent Application. As such, all the resources may be shared (e.g. application, session information). If the composed/ sub VD is configured as a separate Application, the resources are not shared (even if the same ApplicationPool is in use!). The reason is that the resources are isolated based on the ApplicationDomain.
To deal with request/ session/ DB timeout, the following UML class diagram is relevant: