Friday 9 January 2015

“The type is not registered as safe” when trying to add a webpart to a page in SharePoint 2010

Issue Description:

I had a SharePoint web part solution that is created by my Onsite Colleague. I have deployed the same solution in my Local SharePoint Environment and the Web Part added to the solution gallery. When I add the WebPart to the Page it worked perfectly as it was working on my client colleague machine. So no problem at all. Problem started when he has send the solution second time after doing some modification. Again I followed the same Process to deploy the web part solution. Web part was available in web Part Gallery but whenever I try the webpart to the Page it gives Error: “The type is not registered as safe”
For Information I was using VS 2010 to deploy the Farm Solution to the SharePoint 2010 single Machine Environment.


 I have heard this error before and I know the solution to that might be Safe Control Entry is not added properly to web config of SharePoint Web application but it was not that case. Safe Control Entry was properly added. Next I check the assembly Public Key Token which was present in GAC and match with Assembly Key Token present in the Register safe control entry in Web Config of the Web Application. Still I found both the Public Key Token also same. After this I started to take help from Google but most of the Blogs were almost saying the same which I tried initially to solve the Issue.
I Have spent more than 6 Hours to figure out what and where is going wrong, so I am not able to add the Web Part.


Finally I have found the Issue with the Name space of the web part. It was changed from the previous correct Namespace. Once I have change back the same old Namespace it was working fine. So be careful and check the proper Namespace of the Webpart and same Namespace should be registered into the Safe Control of Web Config File. Please Ask me if you still face the issue

No comments:

Post a Comment