The reason behind this is a silly mistake that developers do, when trying to use the SPSite/SPWeb objects. Here is the bad code that resulted in the error:
Thats about it, my code started working when I removed the using clause from the SPContext.Current.Site. The same thing is true when you try to either explicitly/implicitly Dispose the SPContext.Current.Web object. So moral of the story never dispose SPContext objects either implicitly leveraging the using clause or explicitly by using Dispose method from in your finally block.
Watch out for the SharePoint Object Model coding best practices at : http://www.sharepointfix.com/2008/12/best-practices-disposing-sharepoint.html
Thank you!
ReplyDeleteThanks, wonderfull!
ReplyDelete... to you solution and shame on Sharepoint.
ReplyDeleteYour solution worked for me, thanks!
ReplyDeleteGreat fix! Thank You!
ReplyDeletethank you
ReplyDeletethx bro to give such a good and detail explanation about this information
Deletethank you
ReplyDelete