Curioscoding

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

{

[Guid("2e92399d-13e2-44cf-9cbf-e01858864e82")]

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

{

protected override void Render(HtmlTextWriter writer)

{

try

{

SPSite site = SPControl.GetContextSite(Context);

SPWeb web = site.OpenWeb();

writer.Write(web.Users.Count);

SPUser user = web.CurrentUser;

}

catch(Exception e)

{

writer.Write(e.Message);

}

}

}

}

I have found the solution:

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