I'm trying to access webpages_Membership table (I'm using SimpleMembership) to retrieve the account ConfirmationToken.
How do I access this table from my model/controller/DAL?
The only thing I can think of is executing pure SQL from my code to get this value, but that's doesn't seem like it's the right thing to do, nor elegant.
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;
Using the confirmation feature for ASP.NET Web Pages security
Get Account Confirmation Token?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With