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

Sep 16, 2010 at 4:01 PM

Has anyone gotten this to work.  I keep getting the following error: 

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

It is marked as safe in my web.config and it is in the GAC.  I have even tried putting it in the bin folder.  I also restarted my server each time.  

Oct 2, 2010 at 5:03 PM

Yes, to solve this error you have to correct SafeControl in web.config:

<SafeControl Assembly="SmartParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e07dad8271c64e74" Namespace="SmartPart" TypeName="*" Safe="True" SafeAgainstScript="False" />

or better in Visual Studio in SmartPart folder properties -> Safe Control Entries -> overwrite namespace to SmartPart

Feb 1, 2011 at 4:12 PM

I am getting the same error with the webpart actually being registered as a safe control. I deployed using VS2010 and can't seem to get rid of this error. Does anyone else know what it may be?

Coordinator
Feb 21, 2012 at 2:29 PM

Verify the namespace and PublicKeyTokens are correct. They again are not the same as the 2007 version as I do not have Jan's original signature file which produces the tokens.

Jun 1, 2012 at 5:37 PM

I've also run into this, but I may be moving it over from 2007 wrong.  Plus I don't quite grasp it.  This is just a webpart framework for other parts to live in.  I know on my 2003 server, Sharepoint 2007, they lived in a UserControl folder, but there isn't the same directory in 2010.  After a migration, I still see the web parts, but get the above error as well.  I verified it's listed as safe with the corresponding assembly token.  What am I missing?

Jul 30, 2012 at 4:30 PM

@brollman --> Just forget about Jan Thielen's version for 2007. You shouldn't be moving anything over. In fact, I would remove it entirely. I set up a new farm and this is a completely different install. 

Steps I used to install are:

1) Download the solution files from codeplex. 
2) Open in visual studio and build the solution.
3) Take the .dll from the bin folder, install it to the GAC. 
4) Upload .wsp file. 
5) Modify web.config with: <SafeControl Assembly="SmartParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e07dad8271c64e74" Namespace="SmartPart" TypeName="*" Safe="True" SafeAgainstScript="False" /> 
6) Create UserControls folder in root of web application. Drop in your .ascx files.
7) Start using them.