Opening an SPWEB Object

can be done in one of two ways

SPWeb thesite = CurrentSite.OpenWeb(webGuid);

But you must dispose!

thesite.Dispose();

OR

using (SPSite CurrentSite_d = SPContext.Current.Site)

{

using (SPWeb thesite_d = CurrentSite_d.OpenWeb())
{

//MEMORY IS CLOSED OUT AT END OF CODE BLOCK

}

}

Comments are closed.