Search code examples
sharepoint-2010web-partssafecontrols

Add ContentEditorWebPart to the list of Safe Controls


I need to add the ContentEditorWebPart in the list of SafeControls because of this. Unless there's a better way...

The problem is, I don't want to add it manually, i want to do this automatically when I deplou my solution.

So I tried adding my safe control to the .spdata of the module requiring this, like this:

<SafeControls>
    <SafeControl Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.WebPartPages" TypeName="ContentEditorWebPart" Safe="True" />
</SafeControls>

but when I check my web.config, it changes the assembly to my projects assembly..

And if I add it to my package, i have to deploy the Sarepoint dll with it.

So What is the best way to add it to the SafeControls?


Solution

  • For the record, I've decided to add a feature receiver which is gonna use SPWebConfigModification to add the safe control too the web.config

    for details see How to: Add and Remove Web.config Settings Programmatically