AI OnAI Off
Don't know if this solves you problem, but you should remove your events aswell and move your _pageEventAttached into the if-statement.
if (!_pageEventAttached)
{
PageBase.PageSetup += new PageSetupEventHandler(PageSetup);
_pageEventAttached = true;
}
public void Uninitialize(EPiServer.Framework.Initialization.InitializationEngine context)
{
PageBase.PageSetup -= new PageSetupEventHandler(PageSetup);
_pageEventAttached = false;
}
Otherwise I guees you could end up with multiple events.
My initialization module behaves a bit strangely, it seems to initialize at random. Sometimes it's run 4, 5, 6 times in a row, and then it just won't initialize.
This happens in the development environment as well as in stage. I've set break points in the Initialize method and they're sometimes not hit.
What can be wrong? Here's the code: