Hello Group,
I am having a problem with a very basic custom web part. I know this works
but for some reason my current installation is not cooperating....Here is my
code and the error:
protected override void RenderWebPart(HtmlTextWriter output)
{
try
{
// simple default code
output.Write(SPEncode.HtmlEncode(Text));
// this is where the error occurs
SPSite site = SPControl.GetContextSite(Context);
}
catch(Exception ex1)
{
output.Write(ex1.ToString());
}
}
Here is the error:
System.Security.SecurityException: Request for the permission of type
Microsoft.SharePoint.Security.SharePointPermission,
Microsoft.SharePoint.Security, Version=11.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c failed. at
System.Security.CodeAccessSecurityEngine.CheckTokenBasedSetHelper(Boolean
ignoreGrants, TokenBasedSet grants, TokenBasedSet denied, TokenBasedSet
demands) at
Does anyone have any clues what is causing this? Thank you very much