The fix for this is to create a custom control and register to the unload event:
Unload += (object sender, EventArgs e) =>
{
System.Web.HttpContext.Current.Response.StatusCode = 404;
System.Web.HttpContext.Current.Response.Flush();
System.Web.HttpContext.Current.Response.Close();
};
Make sure that you do NOT use:
System.Web.HttpContext.Current.Response.End();
Because this will trigger the error:
Only one page manager (CMSPageManager or CMSPortalManager) is allowed on the page.