I get a lot of questions of starting SharePoint developers that when setting up their development area and try to test their newly created WebParts they often get the error message "Not registered as safe on this website...".
This message can mean anything because it is a standard message from SharePoint. But in most cases the following will work. So here a simple but handy walkthrough when you are developing WebParts.
- Set your debug output folder of your WebPart Library development to the bin folder of your Portal
- Make sure that there is a <SafeControl .... /> tag placed in the web.config
- Use a tool like InstallAssemblies to generate your dwp files and add them to your Portal
- Set the trust level to "Full" in the web.config
Important!!
Keep in mind that taking these steps will give you full control of all API stuff in SharePoint. But a lot of it is under CAS (Code Access Security) which means that if you do not have sufficient rights the method or property will throw an exception.
So always test your WebParts in a test environment when they are for example signed and try to access it with a SharePoint user not having the same role as the Administrator does. (in most cases when you are developing you have Administrator rights)