Introduction

When adding a K2 Worklist web part to a newly created Web Application, a user will encounter the safe control error and find there are missing safe control entries in the site collection Web.config compared to that of a site where this issue is resolved.

Error Scenario

Shown below is an example containing the steps to reproduce the safe control error that occurs if certain K2 solutions are not deployed manually after creating a new Web Application and Site Collection.

Create a new site
Create a new Web Application and Site Collection by selecting “New” from the SharePoint Central Administration Web Applications ribbon and filling in all details

Activate all K2 Features
The steps necessary to activate K2 Features in SharePoint are covered in the K2 Help documentation at: Installation and Configuration > Configuration > SharePoint > Process Portal Web Parts > Activate K2 Web Parts in SharePoint 2010

Finally, verify that all the connection settings are correct based on your K2 installation. Select the Site Collection where you wish to add the K2 Settings, and click OK

Sign in to the created site
By editing the main page of the created site and adding the K2 Worklist Web Part the user will encounter the following safe control error: 'A Web Part or Web Form Control on this page cannot be displayed or imported. The type is not registered as safe.'

 Image

Checking the newly created Site Collection web.config

Although not necessary, the user can check in the web.config file and will find only two “SourceCode.Sharepoint” entries are present.
SourceCode.Sharepoint.ApplicationPages
SourceCode.Sharepoint.ProcessPortal

 Image

On a site where the solution has been implemented, there will be 6 entries in the web.config file:
SourceCode.Sharepoint.ApplicationPages
SourceCode.Sharepoint.ProcessPortal
And an additional four SourceCode.Sharepoint.WebPart.Reporting entries

Image

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


Resolution
Once the Web Application and Site Collection have been created, proceed to K2 Solution Management in SharePoint Central Administration (System Settings > Manage Farm Solutions) and manually deploy “Process Portals.wsp”, ”Reporting Web Parts.wsp” and “K2worklistwebpart.wsp”. Then activate all K2 Features.