you need to add this to the featureActivated function for feature recivers
SPWebConfigModification safeControl = new SPWebConfigModification();
safeControl.Path = "configuration/SharePoint/SafeControls";
safeControl.Owner = ModuleNameGoesHere;
safeControl.Name = "SafeControl[@Assembly='assembly.Name.goes.Here, Version=1.0.0.0, Culture=neutral, PublicKeyToken=87b3480442bff091'][@Namespace=Namespace.Name.goes.Here'][@TypeName='*'][@Safe='True']";
safeControl.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
safeControl.Sequence = 0;
safeControl.Value = "<SafeControl Assembly='assembly.Name.goes.Here, Version=1.0.0.0, Culture=neutral, PublicKeyToken=87b3480442bff091' Namespace=Namespace.Name.goes.Here' TypeName='*' Safe='True' />";
mService.WebConfigModifications.Add(safeControl);
mService.Update();
mService.ApplyWebConfigModifications();
the code above adds the the feature or whatever it maybe to the safe controls in web.config for you! this is the recommended way and abides by best practices. So when you activate the feature it will add the safe controls :)
EDIT
more can be found here similar to the example above! and yes this is best practice and was put inplace by microsoft specificaly for registering safecontrols without you manually doing it and it automatically gets added every time you activate the feature on the required web.config thats within the webapplication so no need to do it manualy multiple times :) :
A collection of web.config modifications is a set of commands that,
when processed by the web.config manipulator in Microsoft SharePoint
Foundation, change the state of the web.config file. You can string
together a set of these commands to ensure that they apply the desired
tags and attributes within web.config. Each modification is expressed
as an object in the administrative object model.
Use the WebConfigModifications property of the SPWebApplication or
SPWebService class to get the collection of web.config modifications
either in the Web application or in all Web applications within the
Web service. To apply modifications that you define through the
SPWebConfigModification class to the web.config files in the server
farm, call the ApplyWebConfigModifications method on the current
content Web service object, as follows:
SPWebService.ContentService.ApplyWebConfigModifications
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebconfigmodification.aspx
hope it helps :)
EDIT 2
If its a webpart then yes you should have a manifest file called manifest.xml with the following:
<?xml version="1.0" encoding="utf-8" ?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="{C1938CC9-A1A3-4e20-932C-33ECB2C47481}">
<Assemblies>
<Assembly DeploymentTarget="GlobalAssemblyCache" Location="WebPartsname.dll">
<SafeControls>
<SafeControl Assembly="namespacegoeshere, Version=1.0.0.0, Culture=neutral, PublicKeyToken=918d2ffdab83e9e8"
Namespace="namespacegoeshere" TypeName="*" Safe="True"/>
</SafeControls>
</Assembly>
</Assemblies>
</Solution>
hope it sheds some light :)