Tuesday, September 27, 2011

SharePoint 2010 / MOSS Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))

This Error occurs when adding a wepart to page or changing webpart from one zone to another zone because the webpart is disposing the spsite or spweb object. If your code looks like below:

using (SPWeb web = SPContext.Current.Web)

{
//some coded here

}

Change it to the format below:

SPWeb web = SPContext.Current.Web;


// your code here

And the Exception (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION)) should be resolved.