How can I find the name/ID of the WebApp that a page is running within on IIS7?


How can I find the name/ID of the WebApp that a page is running within on IIS7?



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)

1:



What is the proper way to map .html to the ASP.NET pipeline in IIS7
I believe this blog post has an example of what you are trying to do..
IIS Issue? Site not coming up all of a sudden


How do I disable chunked transfer-encoding when using compressed dynamic content?


73 out of 100 based on 63 user ratings 913 reviews

@