Tag Archive for CAS

Get CAS IPermission for exception

If you’re working on a SharePoint solution that requires a custom code access security (CAS) policy, the following is an easy way of determining the permission(s) you need to add to the config.

For this to work, you need to be able to debug the code, which should be a given, considering you’re creating a custom CAS for a solution you’re writing . 🙂

A basic CAS will look something like:

<codeaccesssecurity>
  <policyitem>
    <permissionset class="NamedPermissionSet" version="1">
      <ipermission class="SecurityPermission" version="1" Flags="Execution"></ipermission>
      <ipermission class="AspNetHostingPermission" version="1" Level="Minimal"></ipermission>
      <ipermission class="Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" version="1" ObjectModel="True"></ipermission>
    </permissionset>
    <assemblies>
      <assembly Name="$SharePoint.Project.AssemblyName$" Version="$SharePoint.Project.AssemblyVersion$" PublicKeyBlob="$SharePoint.Project.AssemblyPublicKeyBlob$"></assembly>
    </assemblies>
  </policyitem>
</codeaccesssecurity>

Read more

Follow

Get every new post delivered to your Inbox

Join other followers: