Trust Error

May 2, 2008 at 6:46 PM

I followed the instructions provided in your web site, but when I try to add it, sharepoint raises the following error:
Microsoft Virtual Map webpart: Request for the permission of type 'Microsoft.Sharepoint.Security.SharepointPermission, Microsoft.Sharepoint.Security, Version=, Culture=neutral, PublicToken=71e9bce111e9429c' failed.

My webconfig is set to WSS_Minimal trust level and the webpart is listed as safe control
"<SafeControl Assembly=", Version=, Culture=neutral, PublicKeyToken=31fcab8b3a9a0ae6" Namespace="" TypeName="*" Safe="True" />"

Can you tell me if I need to do an extra step in order to get the webpart working.



May 27, 2008 at 5:31 PM
Fede - the issue is the trust needs to be set to "Full" rather than "WSS_Minimal", or the assembly needs to be deployed into the GAC. Let me know if that doesn't help.

Aug 26, 2008 at 5:21 PM
Edited Aug 26, 2008 at 5:37 PM
Hey Phil,

I have deployed to the GAC and am still getting similar trust error - here are my solution settings:

Name: virtualearthwebpart.wsp
Type: Core Solution
Contains Web Application Resource: Yes
Contains Global Assembly: No
Contains Code Access Security Policy: No
Deployment Server Type: Front-end Web server
Deployment Status: Deployed
Deployed To: http://servername/
Last Operation Result: The solution was successfully deployed.
Last Operation Details: SERVERNAME : http://servername/ : The solution was successfully deployed.
Last Operation Time: 8/26/2008 11:07 AM

Should I have set allowcaspolicies when deploying?
Better yet can you provide code syntax for GAC deployment? This might prevent further inquiries.


Here is full error:

Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.

Source Error:

[No relevant source lines]

Source File: c:\WINDOWS\\Framework64\v2.0.50727\Temporary ASP.NET Files\root\a4f31449\f8761c2b\App_Web_-ov05fcy.0.cs    Line: 0

Stack Trace:

[SecurityException: Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.]
   Microsoft.SharePoint.SPWeb.SetAllowUnsafeUpdates(Boolean allowUnsafeUpdates) +43
   Microsoft.SharePoint.SPWeb.set_AllowUnsafeUpdates(Boolean value) +50 sender, EventArgs e) +170
   System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +101
   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +100
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11031975
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11031514
   System.Web.UI.Page.ProcessRequest() +91
   System.Web.UI.Page.ProcessRequest(HttpContext context) +240
   ASP.SPSTD1_ASPX__386071136.ProcessRequest(HttpContext context) in c:\WINDOWS\\Framework64\v2.0.50727\Temporary ASP.NET Files\root\a4f31449\f8761c2b\App_Web_-ov05fcy.0.cs:0
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +599
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171

Sep 16, 2008 at 4:37 PM
sorry for the delay - i have trouble keeping up with the support of these threads sometimes. Did you ever have any luck? I'm not sure off hand what could be the issue... feel free to email me via my web site and I'd love to personally help you out:
Oct 3, 2008 at 6:37 PM
I had the same issue, this worked for me:
  1. Start the Visual Studio Command Prompt (in the program group Visual Studio Tools).
  2. Go to the directory where the dll is installed (typically c:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin).
  3. Run the command gacutil /i newwebpartdll.dll.
  4. Run iisreset.