A Web Part or Web Form Control on this Page cannot be displayed or imported. The type is not registered as safe. Sharepoint 2010

sharepoint-2010

I'm getting stuck with the above mentioned error. I have successfully deployed the webpart in 3 different ways, throgh stsadm, through Powershell (add-spsolution, install-spsolution) and via Central Administration.
The Webpart is .wsp which ran without any problems in Sharepoint 2007. I have changed the <safe control>entries in the web.config.

  <SafeControl Assembly="TimeRecordingWP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" Namespace="TimeRecordingWP" TypeName="*" Safe="True" AllowRemoteDesigner="True" SafeAgainstScript="true" />
  <SafeControl Assembly="TimeRecordingWP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" Namespace="TimeRecordingWP.Controls" TypeName="*" Safe="True" AllowRemoteDesigner="True" SafeAgainstScript="true" />
  <SafeControl Assembly="TimeRecordingWP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" Namespace="TimeRecordingWP.Util" TypeName="*" Safe="True" AllowRemoteDesigner="True" SafeAgainstScript="true" />
  <SafeControl Assembly="TimeRecordingWP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" Namespace="TimeRecordingWP.Dao" TypeName="*" Safe="True" AllowRemoteDesigner="True" SafeAgainstScript="true" />

I have changed the <trust>parameter to Full but no success. Neither the Preview in Webpartcatalog->all webparts nor the webpart will work showing the message named in the title of this post.
I'm pretty lost.

Thank's in advance..

Best Answer

I managed to fix the problem.

My case was:

  • Created new Visual Web Part with Visual Studio 2010
  • Copied some stuff from similar project
  • Renamed some properties to project-specific names
  • Got this error when tried to add the webpart to a page.

Thing that fixed my issue: Changed Namespace value of SafeControl in SharePointProjectItem.spdata (hidden file) to match the actual namespace I was using

Hope this helps :)

Related Topic