To get current logged in user for Sharepoint use this piece of code. You can use this code with custom forms where it gets the current logged in user name.
SPWeb getcurweb = SPControl.GetContextWeb(Context);
SPUser getcurlogeduser = getcurweb.CurrentUser;
string currentusername = getcurlogeduser.Name;