When tried to add webpart to a page, user is getting the below (screen shot) error and not able to add the webpart.

Note : Another user tried to add webpart in the same page and got the same error

enter image description here

  • Can you also add some code here ? Looks like some issue in disposing the objects. Commented Jan 27, 2017 at 4:54
  • use exception handling in your code and then add it.
    – akbar ali
    Commented Jan 27, 2017 at 5:34

1 Answer 1


Either this Web part is a custom one and has not been development correctly: it disposes (i.e. use of SPWeb.Dispose) the contextual SPWeb object (the one from SPCOntext.Current).

Or the problem can be in another custom Web part placed on the page before the new one. That first Web part has the problem of disposing the contextual SPWeb but this only impacts (randomly, because of memory management mechanisms) the Web parts after it.

So, it is most probably a coding error in a custom Web part. This needs a code review on it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.