1

I am working on a custom web part, that keeps error out with:

A web part or web form control on this page cannot be displayed or imported. the type is not registered as safe

any time I actually try to add it to the page. I created an "Empty SharePoint" project in Visual Studio and then added an ascx file.

I have checked the "Assembly Deployment Target" in the project properties and it is set to GlobalAssemblyCache. How to I get around this error?

1 Answer 1

2

You should mark your control as safe. look there

for web parts you can do this:

  1. Open your SharePoint web part project inside visual studio 2010.

  2. Select the web part folder for which you want to change the safe control entries in web.config file.

  3. Press F4 to open properties window (I am not talking here for property page.).

  4. In properties windows there is last entry of properties displaying as “Safe Control Entries“

  5. Click on the eclipse sign in front of “Safe Control Entries” value.

  6. Inside “Safe Control Entries” pop up window, check for Namespace properties inside SafeControlEntry1 properties panel.

  7. Change value of namespace property according to your namespace and class and click ok.

  8. Save and build the solution and deploy it again.

  9. Now after successful deployment check web.config of site and voilà you’ll find the correct safe type entries of your web part.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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