public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { SPWebApplication webapp = properties.Feature.Parent as SPWebApplication; if (webapp != null) { if (!webapp.UpdateMappedPage(SPWebApplication.SPCustomPage.AccessDenied, null)) { throw new ApplicationException("Cannot reset the default Access Denied Page Mappings."); } webapp.Update(true); } } }