Recently I had to create a custom membership provider for a client which required authentication through two user ids and fragments of the users password. You can understand that using the Logon control that comes out of the box with ASP.NET 2.0 will not accommodate this membership provider, so I went about creating my own form control to submit the data to the membership provider I created.
All worked fine however I couldn't for the life of me figure out how to actually set the users Context.User.Identity.Name which will basically allow you to identify the user once logged in. This is something the log in control does automatically for you that you don't usually have to think about, anyway the simple line of code is below.
FormsAuthentication.SetAuthCookie(userName, false)