SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have deployed a custom webpart to a TeamSite using Visual Studio. I get this error message when i try to insert it to the home page.

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

I have checked the web.config and the entry for this webpart is very much there!

Any help is much appreciated! Thanks!

share|improve this question
Does the webpart type and assembly the .webpart or .dwp file in the web part gallery match the details in web.config? – James Love Jun 2 '11 at 10:38

There are three places that need to be synchronized in order a SafeControls entry to work:

1) The class file's namespace + class name 2) The SafeControls entry 3) The .webpart file

Watch out with Visual Studio 2010's namespacing, as when you create a new web part it will add the webpart name to the end of the namespace. If you remove that, so that all the web parts in your project use the same namespace, you'll need to also update the SafeControls entry and .webpart file accordingly.

share|improve this answer

Please check this post. You might find some solution.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.