I write a webpart in C# for sharepoint 2007 .When i try to create instance of SPSite or SPWeb , for example:
SPSite sit = new SPSite("http://sharepoint");
or
SPSite sit = SPContext.Current.Site;
Or even when I :
SPSecurity.RunWithElevatedPrivileges(delegate()
{
int t = 0;
});
I get the below security execption :
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=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.
How can I solve it?