Thursday, October 8, 2009

Unable to add selected web part(s).

Sometime when we try to add a web part we might get the following message:

Unable to add selected web part(s).
Assemblies that implement ASP.NET Web Parts and are installed into a partially trusted location, such as the bin directory, must be compiled with the AllowPartiallyTrustedCallers set for import to succeed.

Solution:

Add the follwing to the AssemblyInfo.cs

using System.Runtime.InteropServices;

using System.Security;


[assembly: AllowPartiallyTrustedCallers]

This should work.

No comments: