Unable to add selected web part(s).

Every once in a while when you create a web part or upgrade web part, or do some of things developers do when developing web parts, there comes the chilling moment, when you see an error message such as the one below:

So the question is what we do in this case? Before you hit the discussion boards, or worse, start pulling your hair, here are couple of tips you can use to troubleshoot the issue:
1. Make sure the control is registered as safe in the web.config (...actually the error says what it means, right)

2. Make sure the assembly is accessible and in the [port]bin folder. (obvious, but worth mentioning)

3. Make sure the assembly name in the *.webpart definition file, matches the assembly name in the safe control element in web.config

4. Make sure you don't have more than one *.webpart file for the same web part in the web part catalog. This may happen if you changed the name of the *.webpart file.

5. Restart IIS to start clean. Attach the debugger to the w3wp.exe process and try to load the page with the rogue web part. This way you can determine the exact location of the assembly you are loading.

6. Check if the web part class exists by opening the assembly with reflector. This might sound funny, but in a bigger team, when different versions of assemblies are flying around it is very easy to overlook something and to use the wrong version, which so happens does not contain the web part class at all.

If you have other tips or suggestions, please add them as comments.

Comments

Popular posts from this blog

Understanding Top line and Bottom line?

How to activate PF UAN account

Scrum Master vs Product Owner