Edit: Sorry, I just noticed what you get SpContext.Current.Web. This is a shared resource, and you should not call it dispose, as @Servy pointed out. Let the structure take care of this for you.
SPWeb. Dispose , , using, :
private bool isSubSite()
{
using (SpWeb currWeb = SpContext.Current.Web){
using (SPWeb rootWeb = currWeb.Site.RootWeb){
if (currWeb.ID != rootWeb.ID)
return true;
return false;
}
}
}
, using, try...finally finally, , .
, Dispose, Close SPWeb . , .