Sharepoint Dispose

Apparently I was informed that when instantiating an SPWeb or SPSite object, I should call Dispose on those objects to make sure they’re released.

Until one day I stumble upon this lovely error:  “Trying to use an SPWeb object that has been closed or disposed and is no longer valid”

So I google it and find out that I’m trying to dispose the current context of an SPWeb that needs to be used by other controls on the page.

Tags:

1 Comment

rssComments RSS   transmitTrackBack Identifier URI

Use SPDisposeCheck integrated with VS just like I showed you ;)

Richard fail…


Comment by Landon Bass on July 6, 2009 3:32 pm


addLeave a comment