ASP. NET Identity using Tip (a)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.