Subsites Dispose not necessary

Sep 2, 2009 at 9:34 PM

I was trying to install the subsites webpart.

everything installed, preview looked great.

then I couldn't add the webpart to the page..

kept keeping getting the error "Trying to use an SPWeb object that has been closed or disposed and is no longer valid."

If the object is obtained from the SharePoint context objects (GetContextSite method and GetContextWeb method), the calling application should not call the Dispose method on the object. Doing so may cause the SharePoint object model to behave unpredictably or fail. This is due to an internal list that is kept in the SPSite and SPWeb objects derived in this way. Internally, the object model enumerates over this list after page completion to dispose of the objects properly.

per Microsoft.

removed the Dispose..

Rolf