Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

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.