In my webforms application, I've taken the Login function from the Login page in the accounts folder, and inserted it into Site.Master.cs so people can login from a drop down form on any page. I want to track logins, so I wanted to take the userid of the person logging in and insert it into a table with a datestamp.
However, with this line of code
string thisuser = User.Identity.GetUserId().ToString();
You should try using