Though I use close/dispose method on
SPSite and SPWeb objects, I still keep getting this error in WSS 3.0
error logs. Here is code snippet that might help you to point the
error
SPSite siteColl = SPContext.Current.Site;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
List<WSSSite> stSites = new List<WSSSite>();
using (SPSite ElevatedSiteColl = new SPSite(siteColl.ID))
{
//Top Level WebSite
using (SPWeb rWeb = ElevatedSiteColl.RootWeb)
{
//Loops the site collection and fills stSites list
GetSiteInformation(rWeb, ref stSites, string.Empty);
}
}
}
);
private void GetSiteInformation(SPWeb web, ref List<WSSSite>
stSites, string parentWeb)
{
//Access SPWeb's Title, Url, Description
//Access SPWeb's site owners
//Fill the generic list stSites
foreach (SPWeb subWeb in web.Webs)
{
try
{
this.GetSiteInformation(subWeb, ref stSites,
siteName);
subWeb.Dispose();
}
finally
{
if (subWeb != null)
subWeb.Dispose();
}
}
}
If you have any custom web parts that kind of goes along the same
line, please let me know.