Issues with importing Web Parts

Jan 8, 2010 at 10:41 PM

I am getting the following error when importing content using the deployment wizard:

A web part of Web form control on this page cannot be displayed or imported. The type could not be found or it is not registered as safe.

These are steps I am performing:

Export content from the current site using the "Include All content Descendents"

Delete the site collection, deploy a new solution, recreate the site collection, and Import the content. In the import log I see the following warning:

1/8/2010 12:34:32 PM]: Warning: Could not find WebPart [Unknown: 94382b31-c402-3620-e05d-a6ee375fa90a] in the safe controls list.

Once the content is deployed and I go to one of the pages on the site which has a webpart, it shows an error. When I delete the webpart and try to add it again I see the error I mentioned before:

A web part of Web form control on this page cannot be displayed or imported. The type could not be found or it is not registered as safe.

Any help with this would be greatly appreciated.

Jan 9, 2010 at 10:32 PM


You just need a SafeControls entry in your web.config to tell SharePoint your custom web part is safe - see this in the MSDN docs: Since the Wizard does not deal with anything on the filesystem (e.g. deploying .wsp packages, web.config changes, installation of SharePoint Features etc.) these are considered pre-requisites to deal with before doing the Content Deployment bit.

If the web part was deployed with a .wsp, the SafeControls entry can be added by the .wsp if the SafeControls entry is in manifest.xml.



Jan 10, 2010 at 4:05 PM
Edited Jan 10, 2010 at 4:06 PM

Hi Chris,

Thanks for the response.

The safe control entry is there in the web.config. There is something which is going wrong while importing the content. Once I deply the solution and create a site collection there is no content. At that point if I create a page and add this particular webpart, it works fine. When I Import the content and then go to a page created with the same page layout and add the web part it gives this error. I ahve checked to make sure that the safe entry is there in the web.config, the dll is in the GAC, the wepart is refering to the same namespace etc....

Jan 12, 2010 at 1:06 AM

Hmm, OK let's think. If an error happens whilst importing, the Wizard will let you know about it and will show an error dialog and report it in the log file. I'm assuming this isn't happening, which means the content is at least being imported to the database somewhere. I'd suggest checking the content hasn't been imported under an unexpected subnode somewhere.

Also, remember the wizard can only change content. So if the 3 things which decide if a web part is safe are:

  • the .webpart definition in the web part gallery
  • the SafeControls entry
  • the actual namespace/class of the webpart code

The wizard can only change the first one, since it's content. So did an unexpected version of the .webpart file get imported into in the web part gallery perhaps? What happens to your existing page with the web part after the import? Still working or broken?