Trying to use an SPWeb object that has been closed or disposed and is no longer valid

Jan 27, 2009 at 1:27 PM
I get this error everytime I edit a page that has the random image webpart and select "modify shared webpart" on a different webpart. If I delete the random image webpart then I have no problems editing anything on the page.

Trying to use an SPWeb object that has been closed or disposed and is no longer valid

Jan 27, 2009 at 1:55 PM
I found a couple of sites that seem to explain what is occurring. Any chance I could get your project so I can try to fix it?

http://www.theartofsharepoint.com/2007/06/trying-to-use-spweb-object-that-has.html

http://msdn.microsoft.com/en-us/library/aa973248.aspx




Coordinator
Feb 3, 2009 at 6:29 PM

Thank you for the pointers.  I hadn't been able to reproduce the error on my servers, so didn't know where to start. 
I've taken the pointers from the two sites you linked to and modified the code.  I'm uploading a new version now.

Just and FYI, I always post the source, and would be happy to add any additions/improvements you might come up with.