I am using property bag to store config value using below code.
SPFarm farmObject = SPFarm.Local;
farmObject .Properties.Add("PropertyKey", "PropertyValue");
farmObject .Update();
This code is working fine. But Now if i want to update and remove property than it is not working.
SPFarm farmObject = SPFarm.Local;
if (farmObject.Properties != null && farmObject.Properties.Count > 0)
{
if (farmObject.Properties.ContainsKey("PropertyKey"))
{
farmObject.Properties["PropertyKey"] = "New Property Value";
farmObject.Update();
}
}
Same case for remove also. In farmObject.Update line nothing happens. No error, no message and nothing is working.I have debug but after this update line nothing is happen and debug is not work further. Once after adding farmObject.Update() is not working for update and also for remove also.
I have custom application page in central admin. And on click of button click I have write this code.