예제 #1
0
        private void SetCustomPages(SPFeatureReceiverProperties properties)
        {
            if (properties.Feature.Parent.GetType() == typeof(SPWebApplication))
            {
                webApp = properties.Feature.Parent as SPWebApplication;
                SPWebApplication wap = SPWebService.ContentService.WebApplications[webApp.Id];


                try
                {
                    wap.UpdateMappedPage(SPWebApplication.SPCustomPage.AccessDenied, 15, "/_layouts/ClubCloud/Common/403.aspx");
                    //webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Confirmation, "");
                    wap.UpdateMappedPage(SPWebApplication.SPCustomPage.Error, 15, "/_layouts/ClubCloud/Common/500.aspx");
                    wap.UpdateMappedPage(SPWebApplication.SPCustomPage.None, 15, "/_layouts/ClubCloud/Common/404.aspx");
                    //webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.RequestAccess, "");
                    //webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Signout, "");
                    wap.UpdateMappedPage(SPWebApplication.SPCustomPage.WebDeleted, 15, "/_layouts/ClubCloud/Common/404.aspx");
                    wap.Update(false);
                    SPWebService.ContentService.WebApplications[wap.Id].Update(false);
                }
                catch { }
            }
        }
예제 #2
0
        // Uncomment the method below to handle the event raised before a feature is deactivated.

        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            SPSite site = properties.Feature.Parent as SPSite;

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite _site = new SPSite(site.ID, SPUserToken.SystemAccount))
                {
                    SPWebApplication webApp = _site.WebApplication;
                    if (null != webApp)
                    {
                        webApp.FileNotFoundPage = null;

                        if (webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.AccessDenied, null))
                        {
                            webApp.Update();
                        }
                    }
                }
            });
        }