Posted in: Comments

If you’re listening to DataFactory events like:

protected void Application_Start(object sender, EventArgs e)
{
    EPiServer.DataFactory.Instance.CreatingPage 
        += new EPiServer.PageEventHandler(CreatingOrSavingPage);

    EPiServer.DataFactory.Instance.SavingPage
        += new EPiServer.PageEventHandler(CreatingOrSavingPage);
}

Always check if Page is null in PageEventsArgs. If we're copying a page in edit mode the Page will be null in one of the events!

I've updated the code for my dynamic content fix, check on line 3 in CreatingOrSavingPage.