30 Jul 2008
26 Jul 2010
Link to this post
Our organization's main public website is a Sitefinity site, and we wanted it served up in the root so that the links can be simply www.oursite.com and so on. The site has been running fine in the root, but now we need to add some sub-apps and I'm running into trouble with ASP.NET inheritance. I've read few posts here (and elsewhere online) about using <location> and/or <clear> and <remove> elements, but I can't decide what would be the best approach, because Sitefinity has a very large web.config with lots of sections that can be inherited by the sub-apps (which is what I want to stop).
I would like to avoid (as much as possible) going to the SUB-APP's web.config and putting in <clear> and <remove> elements, because there might be quite a few. Also, if anything gets added to the Sitefinity web.config, I would need to remember to check if it gets inherited to the sub-app and whether it needs a <remove> element as well. If there are multiple sub-apps, this process can become quite messy.
At first, I thought I'll just wrap most of the Sitefinity web.config in <location path="." inheritInChildApplications="false">, and therefore, any sub-apps that get added to the same IIS site will not be "troubled" by the root site. In theory, this would work fine, but there is a problem because Sitefinity has another web.config in the "Sitefinity" subfolder. If I stop inheritance at the root, nothing would get inherited down, not even to the "Sitefinity" subfolder.
So then, the dilemma is, what is the cleanest, most long-term proof approach? Do I stop inheritance at the root web.config so that all sub-apps would be clean and independent, but then perform some duplication by re-adding a bunch of Sitefinity web.config stuff in the "sitefinity" subfolder (so that it can work properly)? Or do I leave Sitefinity's root web.config untouched so that its subfolder ("sitefinity") can inherit all that it needs, but then go to the sub-apps web.configs and add a bunch of <clear> and <remove> elements? Or perhaps some sort of a hybrid approach?
I would really appreciate some thoughts on this from the community (and the Telerik gurus). I realize that this is not really a Sitefinity issue but more of a general ASP.NET one, but considering the setup of a typical Sitefinity site (with a root web.config and a "sitefinity" subfolder web.config), I'd like to see what would the best solution to this. How would YOU take care of this if you were in my place?