简体   繁体   English

ASP.NET Core 2.0使用旧的ASP.NET 2.0数据库结构进行身份验证

[英]ASP.NET Core 2.0 Using old ASP.NET 2.0 database structure for authentication

So I've been developing an ASP.NET Core 2.0 application for a while now and I was wondering if it's possible to use an older SQL database with the following tables in my ASP.NET Core 2.0 application. 因此,我已经开发了一段时间的ASP.NET Core 2.0应用程序,我想知道是否可以在ASP.NET Core 2.0应用程序中使用带有下表的旧SQL数据库。

数据库表

As I read online this is the default database structure for using ASP.NET 2.0 SqlMemebershipProvider classes. 当我在线阅读时,这是使用ASP.NET 2.0 SqlMemebershipProvider类的默认数据库结构。 Is it possible to implement this into my application and if so, how should I approach this? 可以在我的应用程序中实现它吗?如果可以,该如何处理?

The structure you talk about is called ASP.NET Membership and it works for any ASP.NET version, up to 4.5. 您讨论的结构称为ASP.NET成员资格,它适用于任何ASP.NET版本(最高4.5)。
There's no built-in way to run Membership in ASP.NET Core because Membership has been dead for many years. 在ASP.NET Core中没有内置的方式来运行会员资格,因为会员资格已废止多年。 You have two paths to follow: 您有两种方法可以遵循:

  1. Move to ASP.NET Identity, works for both ASP.NET 4.x and Core. 移至ASP.NET Identity,适用于ASP.NET 4.x和Core。 You will need to migrate your data manually. 您将需要手动迁移数据。
  2. Create the classes to consume the data manually. 创建类以手动使用数据。 Notice that you won't have any of the security features of Membership so I strongly discourage this. 请注意,您将没有“会员资格”的任何安全功能,因此,我强烈不建议这样做。

Of course, a 3rd path would be to keep using the outdated Membership on an ASP.NET MVC 5 application. 当然,第三条途径是在ASP.NET MVC 5应用程序上继续使用过时的成员资格。

The old table structure is not compatible with ASP.NET Identity. 旧的表结构与ASP.NET Identity不兼容。 Plain and simple. 干净利落。 Your best path forward is to generate the tables that Identity does use, and then migrate the data from the old tables to those. 最好的前进方法是生成Identity 确实使用的表,然后将数据从旧表迁移到那些表。 Nothing else will work. 没有别的办法了。

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

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