开发者

Add and Remove Web.config SafeControls Programmatically

开发者 https://www.devze.com 2023-02-24 00:16 出处:网络
I am using this link http://msdn.microsoft.com/en-us/libr开发者_开发问答ary/bb861909.aspx The adding a SafeControl to the web.config works good. But the removing does not work! What is wrong?

I am using this link http://msdn.microsoft.com/en-us/libr开发者_开发问答ary/bb861909.aspx

The adding a SafeControl to the web.config works good. But the removing does not work! What is wrong?

Here in comments you can see the same problem http://blog.thekid.me.uk/archive/2007/03/20/removing-web-config-entries-from-sharepoint-using-spwebconfigmodification.aspx


If removing entries added using SPWebConfigurationModifications (SPWCM) fails the cause is usually:

  1. The SPWCM entries has been added more times than they have been removed
  2. The Name field in the SPWCM isn't a correct XPath to find the elements within the Path

But an other question is why do you want to add SafeControl entries using code?

SafeControl entries should be added by entries in the manifest.xml of the WSP package which adds the dll


I tried modifying the manifest.xml file to change the SafeControl because I had changed the namespace for the webpart. Unfortunatly when I did a Deploy it kept overwritting the changes I made in the manifest.xml file. To change the namespace of a webpart so it gets compiled to the manifest.xml file correctly click on the webpart in your Visual Studio 2010 project and edit the Safe Control Entries section and in there you can modify the namespace.

0

精彩评论

暂无评论...
验证码 换一张
取 消