views:

73

answers:

1

Hi,

I need to get current user name in my Wss 3.0 application. What is more I would like to do this inside ItemDeleting method which is inside event receiver for SPList. I've tried SPContext and HttpContext objects but they doesn't work. I have to add that I'm using Membership Provider and SQL Role provider. I'm not using Active Directory. Can anybody help me and tell is there a way to obrain currently logged in user name?

+1  A: 
public override void ItemDeleting(SPItemEventProperties properties)
{
    using (SPWeb web = properties.OpenWeb())
    {
        SPUser user = web.AllUsers.GetByID(properties.CurrentUserId);
    }
}

No need for HttpContext or SPContext. :-)

Tom Vervoort
Thanks! You help me a lot!
truthseeker