How to programatically detect if my application is running in IIS 7.0 Integrated mode from within an ASP.NET page
Asked Answered
G

2

7

Generally we should have control of our AppPools and be able to force the Managed Pipeline Mode. In my case I don't have control and would like to implement the code behind code a little differently based on the Managed Pipeline Mode (Integrated vs Classic). I just don't know how to detect this. Is there a simple way to do it from within the code behind page?

Gagarin answered 26/8, 2010 at 21:41 Comment(0)
K
4

Look at ApplicationPool.ManagedPipelineMode and ServerManager.ApplicationPools Properties. So you can examine ApplicationPool.ManagedPipelineMode of the current AppPool about like this example do, but to do this for ApplicationPool of your application and not for the default application domain like the example do. The ServerManager.ApplicationPools contain all pools including yours one.

Kenzie answered 26/8, 2010 at 22:30 Comment(0)
Z
11

I found a way in .NET 4.0 to do this without referencing the Microsoft.Web.Administration assembly. The System.Web.HttpRuntime class has the UsingIntegratedPipeline boolean property.

Zephyr answered 30/6, 2012 at 17:7 Comment(0)
K
4

Look at ApplicationPool.ManagedPipelineMode and ServerManager.ApplicationPools Properties. So you can examine ApplicationPool.ManagedPipelineMode of the current AppPool about like this example do, but to do this for ApplicationPool of your application and not for the default application domain like the example do. The ServerManager.ApplicationPools contain all pools including yours one.

Kenzie answered 26/8, 2010 at 22:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.