As a rule, we must control our AppPools and be able to force control of the managed pipeline mode. In my case, I have no control and would like to implement code by code in a slightly different way based on the controlled pipeline mode (Integrated vs Classic). I just don't know how to detect this. Is there an easy way to do this from code by page?
See ApplicationPool.ManagedPipelineMode and ServerManager.ApplicationPools Properties. Thus, you can check the ApplicationPool.ManagedPipelineMode current AppPool approximately like this example, but do it for the ApplicationPool of your application, and not for the default application domain, as in the example. ServerManager.ApplicationPools contains all pools, including yours.
ApplicationPool.ManagedPipelineMode
ServerManager.ApplicationPools
I found a way in .NET 4.0 to do this without reference to the Microsoft.Web.Administration assembly. The System.Web.HttpRuntime class has the boolean property UsingIntegratedPipeline .
Microsoft.Web.Administration
System.Web.HttpRuntime
UsingIntegratedPipeline