While trying to add a custom web part in SharePoint we might come across an error like :
"A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe"
This happens when safe control entries are set to false.
This behavior can be corrected in two ways:
1. Adding safe entries in web.config file :
a. Open web.config
b. Locate the SafeControls Tag
c. Make a safe control entry
<SafeControl Assembly="Assembly name, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d8eb6481d8b4beec" Namespace="your webpart namespace" TypeName="*" Safe="True" />
2. Adding safe entries in SharePointProjectItem.spdata file which can be found in your project folder: Project Folder-> Module ->spdata file.
<SafeControl Assembly="Assembly name, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d8eb6481d8b4beec" Namespace="your webpart namespace" TypeName="*" Safe="True" />
In some cases the issue is resolved by following any one of them while in other cases both of these methods need to be implemented.
In some cases the issue is resolved by following any one of them while in other cases both of these methods need to be implemented.



