I have a page running on IIS7. I'd like to know the name or at least the ID of the WebApp that the page is running in. For instance, if you have DefaultWebSite>MyWebApp>virtualDirectory>myPage.aspx, I'd like to have a piece of code that runs within myPage.aspx and prints out the string: "MyWebApp", dynamically, depending on the name of the web app it's running in.
I know there is a namespace for IIS7 config, Microsoft.Web.Configuration, but I'm not seeing any way to tie a page to it's web app during runtime. I can enumerate over the different web site collections, but not sure how to tie it back to the running page.
Path Not Found error when opening VB6 project from a shared folder on Virtual PC 2007 (XP sp3)
What is the proper way to map .html to the ASP.NET pipeline in IIS7
IIS Issue? Site not coming up all of a sudden
How do I disable chunked transfer-encoding when using compressed dynamic content?