Can I get information about the IIS7 virtual directory from Application_Start?

Posted by Keith on Stack Overflow See other posts from Stack Overflow or by Keith
Published on 2010-04-17T16:47:55Z Indexed on 2010/04/17 16:53 UTC
Read the original article Hit count: 237

Filed under:
|

I have 3 IIS7 virtual directories which point to the same physical directory. Each one has a unique host headers bound to it and each one runs in its own app pool. Ultimately, 3 instances of the same ASP.NET application.

In the Application_Start event handler of global.asax I would like to identify which instance of the application is running (to conditionally execute some code). Since the Request object is not available, I cannot interrogate the current URL so I would like to interrogate the binding information of the current virtual directory?

Since the host header binding is unique for each site, it would allow me to identify which application instance is starting up. Does anyone know how to do this or have a better suggestion?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about iis7