.Net Identity 3 on existing solution

南笙酒味 提交于 2019-12-11 17:43:49

问题


I believe that .NET Identity 3 cannot run on an existing (v4.5) ASP.NET solution, but requires .NET Core. I cannot update to .NET Core. Is there a workaround for this? If not then how are people supposed to migrate from ASP.NET Membership to ASP.Net Identity?


回答1:


  1. First of all, I need to note that ASP.NET Core (which works with Identity 3) does not require .NET Core. It can be used either over .NET Core or .NET Framework 4.6.1 (or higher).

  2. I guess you use the default approach in both cases (Membership and Identity) when all information about users, roles, passwords, etc, is stored in some database.

So, the best way to migrate from Membership to Identity is the following:

  • create a new ASP.NET Core project using the default template and with "Authentication" turned on
  • then write a small console program which will move all user-related information from your old membership tables to the new ones (created automatically by ASP.NET Identity)
  • then move all other your controllers and views one by one.

The only problem here - is that Identity will not recognize the passwords' hashes created with Membership. To resolve it you will need to define your own implementation of IPasswordHasher interface and register it in DI container as it's described in this article.



来源:https://stackoverflow.com/questions/47861712/net-identity-3-on-existing-solution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!