Archive for July, 2012

July 10, 2012

System.Security.SecurityException: Request for the permission of type

System.Security.SecurityException: Request for the permission of type ‘System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed

I was getting the above error at the time when a Form (Sharepoint Webpart) submits some data to a sharepoint list. To overcome the above said error follow the below steps:

1. Navigate to the folder => “C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\CONFIG” and open the wss_minimaltrust.config file.

2. Under the XML section <namedpermissionsets> you can find the <permissionset>. After that add the below segement:

<ipermission>
class=”WebPermission”
version=”1″
Unrestricted=”true”>
</ipermission>

Error Details:

Security Exception
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 ‘System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.