Adding your Web Part to the Safe Controls List
why we want to add webpart as safe control in SharePoint?
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.
How to add as safe control
- Open the web.config file in the application root.
- Add a safe control entry for your custom assembly to the web.config file as follows:
<SafeControl Assembly="MyWebPartLibrary, Version=188.8.131.52, Culture=neutral, PublicKeyToken=null" Namespace="MyWebPartLibrary" TypeName="*" Safe="True" AllowRemoteDesigner="True"/>