When you are creating web parts and you try to look at it in another browser, you are sometimes prompted with this unwanted message:
Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type <Name of your WebPart>, Version=220.127.116.11, Culture=neutral, PublicKeyToken=c7317cce5826e891 could not be found or it is not registered as safe.
There are numerous pages on the internet all saying go to your web.config file. DON’T bother.
To get rid of this annoying error message – the answer lies in your Visual Studio solution – inside your packages file!
- In Solution Explorer, open up your ‘Package’ folder. Here you will see a .package file and a template.xml.
- Open the package.package file.
- There are three tabs along the top; Design; Advanced and Manifest. Click ‘Manifest’.
- At the bottom of the ‘Manifest’ screen, there is a ‘+’ button with the text ‘Edit Options’. Click the + button.
- At the bottom of the page, there is a hyperlink, highlighted in blue which says ‘Overwrite generated XML and edit manifest in the XML editor’. Click this.
- When you have clicked the hyperlink in the above step, you will be prompted with this pop up –
Press Yes, and this will disable the designer.
- Disabling this will encounter you with a screen that has two hyperlinks on. Click Edit manifest in the XML editor.
- You should now see an XML file, with the server tags ‘SafeControl’ in them. E.g.
- Finally, to make the application ‘safe’, you will need to add Safe=”True” to the SafeControl tag which contains the namespace.