WSS 3.0 (MOSS/SharePoint), Site Collections, and Server.MapPath
One of my current projects is a Commerce Server/MOSS 2007 integration project. I had the need to know where to store the configuration of a sub-site within a site collection of the main web application.
For those of you familiar with ASP.NET 2.0, you know that if you want to find the root of the application, you use Server.MapPath. Turns out the the root directory (~/) and the bin directory (~/bin — typically) are the same as the parent site. This means that if your sub-site needs to read information from the web.config then you can store it in the web.config of the parent application.
There is one downside to this. If you have multiple instances of the same site definition within the same web application, there is no way to separate values within the web.config. As an example, assume you need to email an administrator when a site experiences a problem but the administrator is different for each subsite. This information cannot be stored in the web.config as both subsites in the site collection will share the configuration.
This may not be news to some, but without years of SharePoint/WSS experience I found this important to share.