繁体   English   中英

如何自定义ASP.Net身份

[英]How should customize ASP.Net Identity

在阅读了大量有关ASP.Net身份的信息之后,我仍然对新添加到ASP.Net身份验证系统中的某些东西感到困惑。

  • 如果我已经有一个带有用户管理表的设计数据库,应该如何使用ASP.Net Identity? 例如,我想将AspNetUsers表映射到我自己的名为UserAccounts的表。
  • 如何将这个新系统与现有的ASP.Net MVC应用程序混合使用?
  • 如果我不想使用代码优先(身份使用代码优先)怎么办?

任何建议都会有所帮助。 提前致谢。

不完全是您问题的答案。 但是您可能想检查一下这个项目:

Visual Studio Gallery上的ASP.NET身份数据库 (项目模板)

它可以用作使用数据库优先开发方法创建自定义ASP.NET Identity提供程序的基础。 当前,它只有Db模式项目模板。 但是很快将有一个自定义的DbFirst身份提供程序项目模板,以及针对它的单元测试。

您必须使用实体框架迁移,这里有一些可以帮助您的良好链接:

http://blogs.msdn.com/b/webdev/archive/2013/10/16/customizing-profile-information-in-asp-net-identity-in-vs-2013-templates.aspx

http://www.asp.net/identity/overview/migrations/migrating-an-existing-website-from-sql-membership-to-aspnet-identity

在此链接中,您可以从MVC4迁移到MVC5

http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and- web-api-2

最后,如果您不想使用EF,我不认为您可以使用身份,asp.net身份需要以下nuget包:

Nuget软件包

Microsoft.Aspnet.Identity.Core
    This package contains the core interfaces of ASP.NET Identity.
    core

Microsoft.Aspnet.Identity.EntityFramework
    This package contains the implementation of ASP.NET Identity system which works with Entity Framework. This means that if you use this package then you can store information in a Sql Server database.

http://blogs.msdn.com/b/webdev/archive/2013/06/27/introducing-asp-net-identity-membership-system-for-asp-net-applications.aspx

暂无
暂无

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

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