How to get site context/information during the PreapplicationStartMethod
When you run the same web based application as a multi-tenant application for different clients is there a way during the Preappl开发者_JAVA技巧icationStartMethod to gain some kind of context to the site that is being started?
More specifically I'd like to get the host header information (the "bindingInformation" attribute value from the applicationHost.config); I have found ways to get this information at the time of a specific request long after the application has started. Is there a way to get the information during the application startup process?
This is an MVC 3 application and IIS 7.5.
I did not find the direct answer to this question for finding the "bindingInformation" at application start up. After reviewing the requirements further. The host header would not have been the best choice for my solution.
The the better solution is to use the System.Web.Hosting.HostingEnvironment.SiteName value instead.
精彩评论