About Me

Having 12 years experience in Microsoft technologies.Since more than 7 years working in SharePoint technologies. Expert in providing consultation for SharePoint projects. Hands on with development and administration.
Showing posts with label Sharepoinnt web part as safe by deafult. Show all posts
Showing posts with label Sharepoinnt web part as safe by deafult. Show all posts

Thursday, 27 October 2011

Making a Web Part Safe by Default

If you have a Web Part and want to make it safe anyway, you can add this information to the solution package, as shown in the following code.
<Solution SolutionId="{2E9DDE85-8822–42EC-3a92–E85537810BAA}"
xmlns="http://schemas.microsoft.com/sharepoint/">
<FeatureManifests />
<ApplicationResourceFiles />
<CodeAccessSecurity />
<DwpFiles />
<Resources />
<RootFiles />
<SiteDefinitionManifests />
<TemplateFiles />
<Assemblies>
<Assembly DeploymentTarget="WebApplication" Location="Apress.WebParts.dll">
<SafeControls>
<SafeControl Assembly="Apress.WebPart, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=a05eff78260564"
Namespace="Apress" TypeName="*" Safe="True"/>
</SafeControls>
</Assembly>
</Assemblies>
</Solution>
This technique is limited to your own Web Parts, where you have control over the packaging process. But it’s the safest way to add controls to web.config.