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
Best Answer
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.