简体   繁体   English

将ASPX页面移植到Sharepoint

[英]Port ASPX page to Sharepoint

I'm trying to port an existing ASPX page, which is part of an existing web site, into a new Sharepoint site. 我正在尝试将现有ASPX页面(属于现有网站的一部分)移植到新的Sharepoint网站中。 The ASPX page is a relatively simple form with some server-side controls, the ability to email form submissions and "Captcha". ASPX页面是一个相对简单的表单,带有一些服务器端控件,可以通过电子邮件发送表单提交内容和“ Captcha”。 The current website has the Newtonsoft.CaptchaControl dll registered in the bin folder. 当前网站的bin文件夹中注册了Newtonsoft.CaptchaControl dll。 So what I need to do is: 所以我需要做的是:

  1. Port the ASPX page into the proper location within the content of a Sharepoint site 将ASPX页面移植到Sharepoint网站内容内的正确位置

  2. Properly register the CaptchaControl dll with Sharepoint and link allow the ASPX page to utilize it 用Sharepoint正确注册CaptchaControl dll,并链接以允许ASPX页面使用它

Set up application page 设置申请页面

The ASPX page would be called an 'application page' in SharePoint. 在SharePoint中,ASPX页面将被称为“应用程序页面”。 You can copy the ASPX to the layouts folder under the "12 Hive". 您可以将ASPX复制到“ 12 Hive”下的layouts文件夹中。 ("%CommonProgramFiles%\\Microsoft Shared\\web server extensions\\12\\TEMPLATE\\LAYOUTS"). (“%CommonProgramFiles%\\ Microsoft共享\\ Web服务器扩展\\ 12 \\ TEMPLATE \\ LAYOUTS”)。 It would then be accessible from any SharePoint site under {URL}/_layouts/CustomPage.aspx (eg http://site/_layouts/CustomPage.aspx or http://site/subsite/_layouts/CustomPage.aspx ). 然后可以从{URL}/_layouts/CustomPage.aspx下的任何SharePoint网站(例如http://site/_layouts/CustomPage.aspxhttp://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. 看来您知道将aspx页以及CaptchaControl.dll的所有DLL放在IIS下SharePoint网站的bin文件夹中。 The DLLs must be signed with a strong name key. DLL必须使用强名称密钥签名。 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. 您还需要将DLL的强命名签名添加到SharePoint网站的web.config文件中的SafeControls列表中。 If you open up the web.config you'll see examples, eg: 如果打开web.config,将看到示例,例如:

<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. 假设您的控件确实在执行某些操作,则需要在SharePoint使用的代码访问安全性文件中将其标记为受信任。 Change the trust level in web.config from WSS_Minimal to WSS_Custom . web.config的信任级别从WSS_MinimalWSS_Custom Go to "%CommonProgramFiles%\\Microsoft Shared\\web server extensions\\12\\CONFIG" and copy wss_minimaltrust.config to wss_customtrust.config . 转到“%CommonProgramFiles%\\ Microsoft Shared \\ Web服务器扩展\\ 12 \\ CONFIG”,然后将wss_minimaltrust.config复制到wss_customtrust.config Edit wss_customtrust.config and make new CodeGroup entries using the public key of your DLLs. 编辑wss_customtrust.config并使用DLL的公钥创建新的CodeGroup条目。 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. 注意:这将使您的DLL在SharePoint Web应用程序中完全受信任。 It is better practice to restrict permissions to those actually required. 更好的做法是将权限限制为实际需要的权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM