This is a really simple code snippet to obtain the current user using the SharePoint object model.
using (SPWeb spweb = SPContext.Current.Web) {
SPUser oUser = spweb.CurrentUser;
string Username = oUser.LoginName;
}
SPUser represents a user in SharePoint services. A new object (oUser) is created from the spweb property, currentUser. We can now access various other properties like LoginName, Name etc.