I wired up the DeletedPage event in my Global.asax like this:
DataFactory.Instance.DeletedPage += this.Instance_DeletedPage;
And my handler:
private void Instance_DeletedPage(object sender, PageEventArgs pageEventArgs)
{
DeleteCustomerRoles(pageEventArgs.PageLink);
}
When I move a page to the wastebin, nothing fires of course since it is moved. When I delete the page from the wastebin - the event fires and I get the deleted page's PageLink in pageEventArgs
.
But... When I instead select the wastebin and clicks on the "Empty wastebin" button, I get the PageLink corresponding to the wastebin - not my deleted page!
Is this a feature or a bug? I see that there is some sort of list of linked pages on the page object in the pageEventArgs
, but I assume that all pages that are deleted (even children) will trigger the DeletedPage event. Is this not true?
Ok, this seems to be a known behaviour:
http://world.episerver.com/Support/Bug-list-beta/bug/33750/
Although there is a setting to revert some of the peculiar behavior, the wastebin part of it remains. I find this really odd, but it seems I'll have to look elsewhere to find a workaround for really getting to know when a page is deleted, regardless of how.