简体   繁体   English

ASP.NET Identity中的自定义表

[英]Custom table in ASP.NET Identity

I created a new table in the database called UserProfile. 我在数据库中创建了一个名为UserProfile的新表。 This table contains, id, name, surname, and email. 该表包含ID,名称,姓氏和电子邮件。 However, when I try to login, it will not let me log in with email. 但是,当我尝试登录时,它不会让我使用电子邮件登录。 Only allowed to log in with a username. 仅允许使用用户名登录。

So how can I only login with Email from UserProfile table? 那么,如何仅使用UserProfile表中的Email登录? Instead logging with UserName in AspNetUsers table.? 而是在AspNetUsers表中使用UserName登录。

Which version of Identity are you using? 您正在使用哪个版本的身份? Sounds like 1.0, a simple solution would be to update to Identity version 2.0. 听起来像1.0,一个简单的解决方案是更新到Identity版本2.0。

Or else you can try writing your own method with in IdentityExtensions class as explained in http://anthonychu.ca/post/aspnet-identity-20---logging-in-with-email-or-username/ 否则,您可以尝试使用IdentityExtensions类中的代码编写自己的方法,如http://anthonychu.ca/post/aspnet-identity-20---logging-in-with-email-or-username/中所述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM