Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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" /> The Assembly is not deployed in GAC, therefore no PublicKeyToken is needed. 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..

share|improve this question

1 Answer 1

i take it you deploy those webparts to the BIN folder rather than GAC, since your publickey token is null. Setting trust level to full isnt a good idea, it would be better to either set a custom Code Access Policy, or to compile your assembly with a public key to make it safe for GAC deployment. That way at least you keep your BIN with partial trust for the rest of the assemblies thats in there.

Editing your web.config s safe controls manually also is a bad idea, especially since you can get the WSP package to add those for you automatically.

One way if doing this is to create a new web part from template and just add your own code/webpart xml, another way is to add your class and webpart xml as an existing item into a new module and then set the safe control entry on the module properties in Visual Studio.

Read one of many blog posts on how to set Safe Controls in VS2010 here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.