Adding custom web part to page: not registered as safe

sharepointsharepoint-2007

I have created a feature that contains 4 web parts. The feature is working great on my dev environment so I am trying to move it over to production. I added and deployed the feature without incident and 2 of the 4 web parts can be added to pages fine. The other 2 produce the following error:

Unable to add selected web part(s).
(Web Part Name): 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.

The web parts are fairly similar, they contain textboxes, dropdowns, and peopleeditors, nothing special. All 4 show up in the web part gallery. I have the following entry in my web.config:

<SafeControl Assembly="xxx_WebPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=274c568f7ef9ca81" Namespace="xxx_WebPart.UI.WebControls.WebParts" TypeName="*" Safe="True" />

I've been searching on the error but most hits seem to point to the web.config entry which I have. I'm stumped as to why 2 of the 4 web parts are working and the others aren't. Any help would be appreciated!

Best Answer

I just ran into the same issue, but my solution was a little different. I had refactored the namespace before working on the web part, but didn't update any of the configuration. As mentioned in the other answer above I updated the WebPart XML file, but that didn't do the trick.

There's a property on the WebPart called Safe Control Entries as pictured below:

Safe Control Entries detail

You'll have to edit the Safe Control Entries collection and update the namespace in the first entry. After you update that, Sharepoint shouldn't complain anymore.

Related Topic