Subscribe: SharePoint SharePoint SharePoint
Showing posts with label SafeControl Assembly sharepoint. Show all posts
Showing posts with label SafeControl Assembly sharepoint. Show all posts

Thursday, January 30, 2014

Web Part cannot be imported.It's is not registered as safe

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"

SharePoint 2013



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.