设置申请页面
ASPX 页面在 SharePoint 中称为“应用程序页面”。您可以将 ASPX 复制到“12 Hive”下的layouts 文件夹中。 (“%CommonProgramFiles%\Microsoft Shared\web 服务器扩展\12\TEMPLATE\LAYOUTS”)。然后可以从{URL}/_layouts/CustomPage.aspx(例如http://site/_layouts/CustomPage.aspx 或http://site/subsite/_layouts/CustomPage.aspx)下的任何SharePoint 网站访问它。
添加安全控制条目
您似乎知道将任何用于您的 aspx 页面的 DLL 以及 CaptchaControl.dll 放在 IIS 下 SharePoint 网站的 bin 文件夹中。 DLL 必须使用强名称密钥进行签名。您还需要将 DLL 的强命名签名添加到 SharePoint 网站的 web.config 文件中的 SafeControls 列表中。如果您打开 web.config,您会看到示例,例如:
<SafeControl Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
Namespace="Microsoft.SharePoint" TypeName="*" Safe="True" />
配置代码访问安全
假设您的控件确实执行某些操作,您需要在 SharePoint 使用的代码访问安全文件中将它们标记为受信任。将web.config 中的信任级别从WSS_Minimal 更改为WSS_Custom。转到“%CommonProgramFiles%\Microsoft Shared\web server extensions\12\CONFIG”并将wss_minimaltrust.config 复制到wss_customtrust.config。编辑 wss_customtrust.config 并使用 DLL 的公钥创建新的 CodeGroup 条目。例如:
<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust">
<IMembershipCondition
class="StrongNameMembershipCondition"
version="1"
PublicKeyBlob="002400000480435694000000060200000024245452534131000400000100453261002888e278243eb86b47eea4be1b23451177126fb9c847085e66e895a64b148c675dabda94d9301f4886a0126887bcd067356affb16a5112baf3198525fc96c45f4178a6263e1a1132bb6c0a4cdaeaccd97b0d4ab42139585700c41e8481feff03e13f30bb0a10ffa7746770d144be94954b7a908fb9bb680ebe611f50f6db" />
</CodeGroup>
注意:这将使您的 DLL 在 SharePoint Web 应用程序中完全受信任。最好将权限限制为实际需要的权限。