Hi guys,

I made some custom webpart but there is some unexpected error which i don't know, because MOSS don't show the error in details.


Here is the code:


using System;

using System.Runtime.InteropServices;

using System.Web.UI;

using System.Web.UI.WebControls.WebParts;

using System.Xml.Serialization;

using Microsoft.SharePoint;

using Microsoft.SharePoint.WebControls;

using Microsoft.SharePoint.WebPartPages;

using Microsoft.SharePoint.Security;


namespace TestWebPart



public class TestWebPart : System.Web.UI.WebControls.WebParts.WebPart


protected override void Render(HtmlTextWriter writer)




SPSite site = SPControl.GetContextSite(Context);

SPWeb web = site.OpenWeb();


SPUser user = web.CurrentUser;


catch(Exception e)







I have found the solution:

This was security issue. I have changed the WSS_Minimal configuration from restricted to full_trust.