I have a diagnostic web page and I need to ensure that the website was installed on the right App Pool version programmatically in ASP.NET.
I am running IIS 7.5 Under Windows 7 but the code also have to work under Windows Server 2008 R2.
I know how to get App Pool name with those two ways:
// First way to do it
string name = System.Environment.GetEnvironmentVariable("APP_POOL_ID", System.EnvironmentVariableTarget.Process);
// Second way to do it
string name = HttpContext.Current.Request.ServerVariables["APP_POOL_ID"];
However, from there, I don't know how to get the App Pool version. I've looked at a lot of webpages and forums but I can't quite find the answer. Anyone can help?