将 ASPX 页面移植到 Sharepoint
我正在尝试将现有的 ASPX 页面(属于现有网站的一部分)移植到新的 Sharepoint 网站中。 ASPX 页面是一个相对简单的表单,带有一些服务器端控件、通过电子邮件发送表单提交和“验证码”的功能。当前网站在bin文件夹中注册了Newtonsoft.CaptchaControl dll。所以我需要做的是:
将 ASPX 页面移植到 Sharepoint 站点内容中的正确位置
正确注册带有 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:
Port the ASPX page into the proper location within the content of a Sharepoint site
Properly register the CaptchaControl dll with Sharepoint and link allow the ASPX page to utilize it
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
设置应用程序页面
ASPX 页面在 SharePoint 中称为“应用程序页面”。您可以将 ASPX 复制到“12 Hive”下的
layouts
文件夹中。 (“%CommonProgramFiles%\Microsoft Shared\Web 服务器扩展\12\TEMPLATE\LAYOUTS”)。然后可以从{URL}/_layouts/CustomPage.aspx
下的任何 SharePoint 网站访问它(例如http://site/_layouts/CustomPage.aspx
或http://site/subsite/_layouts/CustomPage.aspx
)。添加安全控制条目
看来您知道将 aspx 页面的任何 DLL 以及 CaptchaControl.dll 放置在 IIS 下 SharePoint 网站的
bin
文件夹中。 DLL 必须使用强名称密钥进行签名。您还需要将 DLL 的强命名签名添加到 SharePoint 网站的web.config
文件中的 SafeControls 列表中。如果您打开 web.config,您将看到示例,例如:配置代码访问安全性
假设您的控件实际上执行某些操作,您需要在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 条目。例如:注意:这将使您的 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
orhttp://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 theweb.config
file for the SharePoint site. If you open up the web.config you'll see examples, e.g.: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
fromWSS_Minimal
toWSS_Custom
. Go to "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\CONFIG" and copywss_minimaltrust.config
towss_customtrust.config
. Edit wss_customtrust.config and make new CodeGroup entries using the public key of your DLLs. For example:Note: This will make your DLLs fully trusted within the SharePoint web application. It is better practice to restrict permissions to those actually required.