I deployed my WSP to the SP server and activated my solution. When I attempted to add my web parts to a page I get the message:

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

After more research I added the SafeControl attributes to the manifest file. I was able to update it again but now I get this error when I add a web part on the page:

Web Part Error: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred.

Also checked the web.config and I see entries that look correct. My project DLL file is also in the GAC.

Any other ideas?

  • @Unnie Yes a farm solution
    – Alex
    Apr 23, 2014 at 20:56
  • This error normally occurs with sandbox solution.Have you previously deployed this webpart as sandbox by any chance?
    – Unnie
    Apr 23, 2014 at 21:08
  • @Unnie No this is the first time I deploy it. I just used Add-SPSolution to install it.
    – Alex
    Apr 23, 2014 at 21:10
  • r u using CQWP class in your code? Apr 24, 2014 at 6:32

1 Answer 1


Most of the error message shown in the screen are generic error messages they do not give you much details,

If possible turn on verbose logging on your environment and get the exact error message from the ULS log that will give you more details on the issue.

  • Also check if you have given the correct reference for your custom web part details (token etc.) I hope you are using fully qualified name for the DLL. Most of the web part errors i have seen when i am calling my custom class and the code is not able to find any reference. Apr 23, 2014 at 20:53
  • Thanks for the comment. How can I turn this ULS logging on? I'm not a big SP developer, just getting started.
    – Alex
    Apr 23, 2014 at 20:55
  • ULS logs are created in 14\Logs directory. Just open the current file in the ULS Log Viewer and perform the operation. ULS logs record all SharePoint activites Apr 23, 2014 at 21:33

Your Answer

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

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