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!

  • 1
    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.


Please check this post. You might find some solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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