【问题标题】:Add ContentEditorWebPart to the list of Safe Controls将 ContentEditorWebPart 添加到安全控件列表
【发布时间】:2011-07-31 19:24:38
【问题描述】:

由于this,我需要将 ContentEditorWebPart 添加到 SafeControls 列表中。除非有更好的方法...

问题是,我不想手动添加,我想在部署解决方案时自动添加。

所以我尝试将我的安全控件添加到需要此功能的模块的 .spdata 中,如下所示:

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

但是当我检查我的 web.config 时,它会将程序集更改为我的项目程序集..

如果我将它添加到我的包中,我必须使用它部署 Sarepoint dll。

那么将它添加到 SafeControls 的最佳方法是什么?

【问题讨论】:

    标签: sharepoint-2010 web-parts safecontrols


    【解决方案1】:

    为了记录,我决定添加一个功能接收器,它将使用SPWebConfigModification 在 web.config 中添加安全控制

    详情见How to: Add and Remove Web.config Settings Programmatically

    【讨论】:

      【解决方案2】:

      在这种情况下使用SPWebConfigModification 是重复的。 这个功能可以通过编辑文件Package.Template.Xml归档:

      <?xml version="1.0" encoding="utf-8"?>
      <Solution xmlns="http://schemas.microsoft.com/sharepoint/">
      <Assemblies>
        <Assembly Location="Telerik.Web.UI.dll" DeploymentTarget="GlobalAssemblyCache">
          <SafeControls>
            <SafeControl Assembly="Telerik.Web.UI, Version=2012.2.912.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TypeName="*" Safe="True" SafeAgainstScript="False" />
          </SafeControls>
        </Assembly>
      </Assemblies>
      </Solution>
      

      在这种情况下,我在 web.config 的安全控件中添加程序集 Telerik.Web.UI.dll

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2022-01-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多