1.asp.net Identity applies to all types of ASP. ASP. NET MVC, Web Forms, Web Pages, Web APIs, and SignalR.
2. Very convenient extension of user data fields. Just one line of code
Set up your database connection information:
Modify the name of the context:
Open try-"Other Windows-" package management console, run the "Codefirst" 3 section:
Data columns added obediently lay here:
It is important to note that birthday is a datetime data type and this problem occurs
The solution is to assign a value to the birthday each time, or set the field to a nullable type. Here's the assignment for birthday's birthday.
3. several ways to obtain user information:
Controller
View
Results
4. Login and Registration
In short, there is a call applicationsigninmanager of things, get the way as follows, as to why to get this, don't be so paranoid first. What's Owin? Is Owin Bai! What do you care?
Httpcontext.getowincontext (). Get<applicationsigninmanager > ();
Then: basic routines, a method must have synchronous and asynchronous 2 methods, you look at the use!
After the completion of the general pattern of registration: (here registration is done by the way to help landing)
Landing is also the same routine: pay attention to a few results, what kind of thing to say later. Anyway this sign-in is basically the case, this demand has satisfied most of the broken website.
5. Email Confirmation activation function
AccountController, remove the following comment:
The original registration completed after the automatic login code commented out, because there is the mechanism of activation!
In this file to complete the email service code, is currently empty method, the SMTP server and user name password self-fix!
Register the user after the database, this field or false
Duly received an e-mail, as to how this token generated, do not care about these details, can be used on the line.
Whether the validation has changed in this step of the database
As for account activation ability, no activation can not do, you play your own business needs.
6. forgot Password
Remove this part of the comment in the login view
This code comment in the account controller is removed
Click Forgot Password
Receive the email, click on the link in the mail, transfer to this page, set up after the OK
ASP. NET Identity using Tip (a)