Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

system.security. securityexception was unhandled by user code in sharepoint 2010

$
0
0

Hi,

i am getting the below error while deactivating the feature in sharepoint 2010

system.security. securityexception was  unhandled by user code message=access denied

the code is 

        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)
                    {
                        if (webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.AccessDenied, null))
                        {
                              webApp.Update();
                        }
                    }
                }
            });

        }

    }

can any one give the solution for it

Thanks,

Lilu


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>