ASP.NET 用户控件安全异常

在 Microsoft Office SharePoint Server 2007 中加载的 ASP.NET 用户控件生成与连接安全性相关的安全异常,如下例所示:

This control does not allow connection strings with the following keywords: 'Integrated Security', 'Trusted_Connection'

症状

当加载 SharePoint Web 部件或 Web 表单中的 ASP.NET 用户控件时,如果代码在连接字符串中使用 NTLM 身份验证,则会发生安全异常。如果不使用集成 Windows 身份验证,则不会发生安全异常。

原因

默认情况下,不会信任在全局程序集缓存外部加载的控件或程序集。

解决方案

在 Web.config 文件中插入以下行来清除控件的 tagMapping 属性:

<code>
<tagMapping>
   <clear/>
</tagMapping>
</code>

另请参见

其他资源

Microsoft Office SharePoint Server 2007 中的用户控件安全异常