I query the database for the appropriate fields and I use this to create my cookies in C# code, does that help you?
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1, // version
strUser, // user name
DateTime.Now, // create time
DateTime.Now.AddYears(1), // expire time
false, // persistent
"my own data" ); // user data
string strEncryptedTicket = FormsAuthentication.Encrypt( ticket );
HttpCookie cookie = new HttpCookie( FormsAuthentication.FormsCookieName, strEncryptedTicket );
Context.Response.Cookies.Add( cookie );
As for the queries to be run, those are straightforward and documented if you have an aspnetdb instance already up with an asp.net app using them, but I could post more code if you need some stuff for accessing those as well. You were asking about the cookie, so this is how I set my cookies in C#