first post here.

I've having a hard time with a couple things in SharePoint 2013, one is: I'm developing web parts to deploy to a SharePoint site. The problem is that every single time I deploy them I have issues adding them to the page or, if they have already been added, I have issues viewing them.

The error for both situations is:

Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type XYZ Version=, Culture=neutral, PublicKeyToken=XYZ could not be found or it is not registered as safe. Correlation ID: XYZ.

The ONLY way to fix this and be able to add/view the web parts is by unistalling/installing/disabling/enabling it via PowerShell.

As you may imagine, this causes problems when trying to debug a web part since when debugging the web part is not properly activated/installed.

There must be a reason for this to happen. I could not find specific information online.

Any help appreciated. Thanks

  • How you are deploying the web parts? – Amit Feb 5 '15 at 4:32
  • What do you mean exactly? I'm deploying it using Visual Studio 2013. These are the steps that VS go through: Run Pre-Deployment Command, Retract Solution, Add Solution, Run Post-Deployment Command, Activate Features, Recycle IIS App Pool – Naner Feb 5 '15 at 14:56

In your web.config check whether you have entries for this webpart as Safe Registered assembly.

To register a Web Part assembly as a SafeControl

Open C:\inetpub\wwwroot\wss\VirtualDirectories\Port Number of your web application\web.config in Visual Studio or Notepad.

Check if there is an entry for your web part in the block, if not you can add it as below, Change all the details according to your web part.

<SafeControl   Assembly="SimpleWebPart, Version=, Culture=neutral, PublicKeyToken=def148956c61a16b"   Namespace="MyWebParts"    TypeName="*"    Safe="True"/>
  • Thanks, but there is a SafeControl entry already and Safe is set to True. That does not seem to make any difference though! :/ – Naner Feb 5 '15 at 14:54
  • Retract the Webpart, Make sure the web.cofig removes entry for the that webpart and again deploy it. – Akarsh Gupta Feb 6 '15 at 5:03
  • I retracted and it does remove the entries from the web.config file. But still does not fix the issue... :/ – Naner Feb 6 '15 at 14:16

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.