开发者

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

开发者 https://www.devze.com 2023-02-19 13:37 出处:网络
I\'m getting stuck with the above mentioned error. I have successfully deployed the webpart in 3 different ways, thro开发者_如何学Gogh stsadm, through Powershell (add-spsolution, install-spsolution) a

I'm getting stuck with the above mentioned error. I have successfully deployed the webpart in 3 different ways, thro开发者_如何学Gogh 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..


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 :)


Rene. I gave some thoughts to the same matter few days ago. The problem was happened when I created not an empty project and rename some properties in it to more sensible. Unfortunately, I couldn't find the reason of this problem. But I resolved it by creating an empty sharepoint project and adding the necessary items in it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号