My 2p about ERP Solutions, Information Worker Solutions and other software products (mainly Microsoft Dynamics AX and Microsoft SharePoint).

01 September 2008

Setting the trust level for newly installed Web Parts

by Patrik Luca 2 comments

Tag



Problem description: Request for the permission of type 'Microsoft.SharePoint.Security.
SharePointPermission, Microsoft.SharePoint.Security, Version=1


After installing a new SharePoint Web Part, it is not working and you get an error like Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.

Solution: Change the trust level for your SharePoint Web Part


This means the trust level of your newly installed SharePoint Web Part is not set correctly. To fix this, follow these steps:
  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.


Your newly installed SharePoint Web Part will be added to the global assembly cache (GAC) and everything should work fine now.

Comments 2 comments
Anonymous said...

That is not the only solution. You can also increase the trust level of the SharePoint Site. Furthremore, you can also deploy a CAS (code access security file) and explicitly say which permissions your web parts can access (i.e. HD, registry).

Deploying to the GAC is the best practice, but it will not work in the most secure SharePoint admin setups. Putting your assemblies inside the GAC will allow them to do anything in code and not all admins will allow that.

Bart Czernicki
www.silverlighthack.com

Anonymous said...

great, this wroks, thanks sooooo much, i've been searching for this all day long

Patrik Luca, Ieper, BELGIUM
Feel free to use or spread all of the content on my blog. In return, linking back to my blog would be greatly appreciated. All my posts and articles are provided "AS IS" with no warranties.

Subscribe feeds via e-mail
Subscribe in your preferred RSS reader

Subscribe feeds rss Most Read Entries

Subscribe feeds rss Recent Entries

Categories

Recommended Books


Subscribe feeds rss Recent Comments

This Blog is part of the U Comment I Follow movement in blogosphere. Means the comment field of this blog is made DOFOLLOW. Spam wont be tolerated.

Blog Archive

My Blog List

Followers

Links