Add Safe control entry in web.coinfig using SPWebConfigModification Class
SPWebConfigModification Class : Holds modifications that are made to the web.config. Following example helps you to add the safe control entry on feature activation. public override void FeatureActivated( SPFeatureReceiverProperties properties) { try { SPWebService contentService = SPWebService .ContentService; contentService.WebConfigModifications.Add(GetConfigModification()); // Serialize the web application state and propagate changes across the farm. contentService.Update(); // Save web.config changes. contentService.ApplyWebConfigModifications(); } catch ( Exception e) { Console .WriteLine(e.ToString()); throw ; } } public override void FeatureDeactivating( SPFeatureReceiverProperties properties)