将 ASPX 页面移植到 Sharepoint

发布于 2024-08-05 05:44:34 字数 299 浏览 3 评论 0原文

我正在尝试将现有的 ASPX 页面(属于现有网站的一部分)移植到新的 Sharepoint 网站中。 ASPX 页面是一个相对简单的表单,带有一些服务器端控件、通过电子邮件发送表单提交和“验证码”的功能。当前网站在bin文件夹中注册了Newtonsoft.CaptchaControl dll。所以我需要做的是:

  1. 将 ASPX 页面移植到 Sharepoint 站点内容中的正确位置

  2. 正确注册带有 Sharepoint 和链接的 CaptchaControl dll 允许 ASPX 页面使用它

I'm trying to port an existing ASPX page, which is part of an existing web site, into a new Sharepoint site. The ASPX page is a relatively simple form with some server-side controls, the ability to email form submissions and "Captcha". The current website has the Newtonsoft.CaptchaControl dll registered in the bin folder. So what I need to do is:

  1. Port the ASPX page into the proper location within the content of a Sharepoint site

  2. Properly register the CaptchaControl dll with Sharepoint and link allow the ASPX page to utilize it

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

傲性难收 2024-08-12 05:44:34

设置应用程序页面

ASPX 页面在 SharePoint 中称为“应用程序页面”。您可以将 ASPX 复制到“12 Hive”下的 layouts 文件夹中。 (“%CommonProgramFiles%\Microsoft Shared\Web 服务器扩展\12\TEMPLATE\LAYOUTS”)。然后可以从 {URL}/_layouts/CustomPage.aspx 下的任何 SharePoint 网站访问它(例如 http://site/_layouts/CustomPage.aspxhttp://site/subsite/_layouts/CustomPage.aspx)。

添加安全控制条目

看来您知道将 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 应用程序中完全受信任。更好的做法是将权限限制为实际需要的权限。

Set up application page

The ASPX page would be called an 'application page' in SharePoint. You can copy the ASPX to the layouts folder under the "12 Hive". ("%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS"). It would then be accessible from any SharePoint site under {URL}/_layouts/CustomPage.aspx (e.g. http://site/_layouts/CustomPage.aspx or http://site/subsite/_layouts/CustomPage.aspx).

Add safe control entries

It looks like you know to place any DLL for your aspx page as well as CaptchaControl.dll in the bin folder for the SharePoint site under IIS. The DLLs must be signed with a strong name key. You also need to add the strongly-named signature of the DLLs to the SafeControls list in the web.config file for the SharePoint site. If you open up the web.config you'll see examples, e.g.:

<SafeControl Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
    Namespace="Microsoft.SharePoint" TypeName="*" Safe="True" />

Configure code access security

Assuming your controls actually do something, you need to mark them as trusted in the Code Access Security file that SharePoint uses. Change the trust level in web.config from WSS_Minimal to WSS_Custom. Go to "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\CONFIG" and copy wss_minimaltrust.config to wss_customtrust.config. Edit wss_customtrust.config and make new CodeGroup entries using the public key of your DLLs. For example:

<CodeGroup
    class="UnionCodeGroup"
    version="1"
    PermissionSetName="FullTrust">
    <IMembershipCondition
        class="StrongNameMembershipCondition"
        version="1"
        PublicKeyBlob="002400000480435694000000060200000024245452534131000400000100453261002888e278243eb86b47eea4be1b23451177126fb9c847085e66e895a64b148c675dabda94d9301f4886a0126887bcd067356affb16a5112baf3198525fc96c45f4178a6263e1a1132bb6c0a4cdaeaccd97b0d4ab42139585700c41e8481feff03e13f30bb0a10ffa7746770d144be94954b7a908fb9bb680ebe611f50f6db" />
</CodeGroup>

Note: This will make your DLLs fully trusted within the SharePoint web application. It is better practice to restrict permissions to those actually required.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文