From what I understand, there's no direct way to retrieve the value using WebSecurity
helper.
When you create a User and Account the method returns the confirmation token:
string confirmationToken = WebSecurity.CreateUserAndAccount("tester", "test123", requireConfirmationToken: true);
You then send this token (inside a link as a QueryString parameter for example) to the User's e-mail address. When the user clicks the link, your app must get/read this token and then you must call:
WebSecurity.ConfirmAccount(userName, confirmationToken);
As you mentioned you can of course hit the db directly writing your own SQL or even add the webpages_Membership
to an EntityFramewok EDMX model and query the table directly:
var confirmationToken = Database.Memberships.Single(m => m.UserId == userId).ConfirmationToken;
More on this:
Using the confirmation feature for ASP.NET Web Pages security
Get Account Confirmation Token?