CSC510246. Do not dispose PersonalSite or PersonalWeb.

Description

My Site pages, which implement IPersonalPage, implement these properties as shared instances that should not be disposed of by controls that use them.

IPersonalPage currentMySitePage = this.Page as IPersonalPage;
if (currentMySitePage != null && !currentMySitePage.IsProfileError)
{
    using (SPWeb personalWeb = currentMySitePage.PersonalWeb)
    {
        // Do stuff
    } // <- do not dispose!
}

Links

IPersonalPage.PersonalSite property
IPersonalPage.PersonalWeb property

Last edited Jun 26, 2014 at 8:35 AM by dvd73, version 5

Comments

No comments yet.