Thursday, July 24, 2008

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

This Error occurs when adding a wepart to page 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.

1 comment:

ESYP said...

Thank you! It helps :)