Aug 12, 2006 04:59 AM|JohnySmithy2k5|LINK
This problem may occur when the custom assemblies that are referenced in project do not have sufficient permissions.
To grant the required permissions to a custom assembly, follow these steps:
1. Assert permissions in your custom assembly.
2. Make the custom assembly available to project.
3. Reference the custom assembly in your project.
4. Modify the code access security settings for your custom assembly.
Assert permissions in your custom assembly
To acquire the required permissions to run the code in your custom assembly, you must assert the required permissions in your custom assembly code.
For example, if you access data in Microsoft SQL Server tables by using the "System.Data.SQLClient" namespace in your custom assembly, you must add the following code to your custom assembly before you use the "System.Data.SQLClient"
System.Data.SqlClient.SqlClientPermission pSql = new SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
If you access a file in your custom assembly, you must add the following code to your custom assembly before you access the file:
FileIOPermission filePerm = new FileIOPermission(FileIOPermissionAccess.Read, "C:\TestFile");
Similarly, if you access a Web service in your custom assembly, you must add code that is similar to the following to assert the Web permissions:
System.Text.RegularExpressions.Regex urlRegEx = new System.Text.RegularExpressions.Regex(@"http://www\.webcontinuum\.net/.*");
System.Net.WebPermission p = new System.Net.WebPermission(NetworkAccess.Connect,urlRegEx);
For more information about asserting permissions in your custom assembly, visit the following MSDN Web site: