SharePoint C# – SecurityException: WebPermission Request Error
/* Posted June 16th, 2008 at 1:47pm *//* Filed under C#, Microsoft, Programming, SharePoint, Windows */
/* */
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.
If you care getting the error above in SharePoint, there is a simple work around to get your code to work.
1. Open the wss_minimaltrust.config located: “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG”
2. Under the XML section <namedpermissionsets> and under the last <permissionset> add
<ipermission>
class="WebPermission"
version="1"
Unrestricted="true">
</ipermission>
3. Save the file and you are good to go!





















im still getting the exception even after modifying the config file.
Did you manage to get this solved pravin? I have the same error message and I tried the above but still nothing.Please let me know if you got it sorted and how.
Rather try this:
Rather try this:
<IPermission class=”System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″ version=”1″ Unrestricted=”true” >
</IPermission>
Still giving same error
I have posted in one of my post how to modify CAS for this exception with WspBuilder.
It worked like a charm for me.
http://mosshowto.blogspot.com/2009/05/aspnet-chart-control-binding-web-part.html
Hope this help…
Marc