Step 4: Add your Web Part to the Safe Controls List

A fundamental assumption of the Windows SharePoint Services technology is that "untrusted users" can upload and create ASPX pages within the system on which Windows SharePoint Services is running. These users should be prevented from adding server-side code within ASPX pages, but there should be a list of approved controls that those untrusted users can use. One way to provide these controls is to create a Safe Controls list.

The Safe Controls list is a list of controls and Web Parts specific to your SharePoint site that you have designated as safe for invocation on any ASPX page within your site. You store this list in the web.config file in your Web application root.

Prerequisites

Step 1: Develop an ASP.NET Web Part Assembly

Step 2: Place your Assembly in the Bin or Global Assembly Cache

To add your Web Part to the Safe Controls list

  1. Open the web.config file in the application root.

  2. Add a safe control entry for your custom assembly to the web.config file as follows:

    <SafeControl Assembly="MyWebPartLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" Namespace="MyWebPartLibrary" TypeName="*" Safe="True" AllowRemoteDesigner="True"/>
    

Next Steps

Step 5: Create a .webpart File for your Web Part