I have application that adds a Farm feature so Sharepoint 2010. When you configure it, some entries are added to the web.config file located in "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\SecurityToken" Whenever I deactivate the farm feature from the Sharepoint Central Administration interface (System Settings\Manage Farm Features) those entries will be deleted properly from the web.config file. The problem I have is that I want to be able to deactivate the feature programatically so I built an uninstaller that will deactivate all the features created by my .wsp and retract and remove the solution, but when it deactivates the farm feature, the entries made to the web.config file that I previously mentioned are not deleted. I use the folowing line to deactivate the feature :
SPWebService.AdministrationService.Features.Remove(feature.Definition.Id, true);
Let me know if you got any idea or need more information. Thanks.