在MVC中使用ASP.NET成员资格表

时间:2022-09-18 07:31:54

I have a "user management portal" created in .NET 4 Web forms. The portal allows administrators to add and edit users to specific applications (new users get a randomly generated password that's encrypted with whatever web forms uses).

我有一个用.NET 4 Web表单创建的“用户管理门户”。该门户允许管理员向特定应用程序添加和编辑用户(新用户获得随机生成的密码,该密码使用任何Web表单使用加密)。

I want to build an MVC 4 website that authenticates to those usernames and passwords. I know that SimpleMembership is part of ASP Membership but I'm not sure how to go about using the default created website to validate against the webforms username and password. It's not so simple to just set the machine key in the web.config and change the DB to the membership DB.

我想构建一个MVC 4网站,对这些用户名和密码进行身份验证。我知道SimpleMembership是ASP Membership的一部分,但我不知道如何使用默认创建的网站来验证webforms的用户名和密码。在web.config中设置机器密钥并将数据库更改为成员资格数据库并不是那么简单。

So for instance:

例如:

  • User A created in the web forms app with password 1234567
  • 用户A在Web表单应用程序中创建,密码为1234567
  • User A clicks the login button on default MVC app and uses password 1234567 (MVC app defaultConnection string is set to Web form apps database)
  • 用户A单击默认MVC应用程序上的登录按钮并使用密码1234567(MVC app defaultConnection字符串设置为Web表单应用程序数据库)

Does anyone have any tutorials on this or able to help?

有没有人有这方面的教程或能够提供帮助?

1 个解决方案

#1


1  

I believe that in SimpleMembership you can define the "User Profile" table, however it creates its own tables for use with passwords.

我相信在SimpleMembership中您可以定义“用户配置文件”表,但是它会创建自己的表以用于密码。

For instance, you can take any Model class and annotate it with [Table("UserProfile")] To get SimpleMemebrship to use it as the profile table.

例如,您可以使用任何Model类并使用[Table(“UserProfile”)]注释它以使SimpleMemebrship将其用作配置文件表。

Also this answer Entity Framework Code-First Issues (SimpleMembership UserProfile table) helped me a lot in modifying SimpleMemberhip to use my tables.

此答案实体框架代码优先问题(SimpleMembership UserProfile表)帮助我修改SimpleMemberhip以使用我的表。

I think this may be close to what you are lookign for: http://blog.spontaneouspublicity.com/including-asp-net-simple-membership-tables-as-part-of-your-entity-framework-model I think this shows how to set other tables that the default for use with SimpleMembership

我认为这可能接近你的看法:http://blog.spontaneouspublicity.com/including-asp-net-simple-membership-tables-as-part-of-your-entity-framework-model我认为这显示了如何设置默认使用SimpleMembership的其他表

#1


1  

I believe that in SimpleMembership you can define the "User Profile" table, however it creates its own tables for use with passwords.

我相信在SimpleMembership中您可以定义“用户配置文件”表,但是它会创建自己的表以用于密码。

For instance, you can take any Model class and annotate it with [Table("UserProfile")] To get SimpleMemebrship to use it as the profile table.

例如,您可以使用任何Model类并使用[Table(“UserProfile”)]注释它以使SimpleMemebrship将其用作配置文件表。

Also this answer Entity Framework Code-First Issues (SimpleMembership UserProfile table) helped me a lot in modifying SimpleMemberhip to use my tables.

此答案实体框架代码优先问题(SimpleMembership UserProfile表)帮助我修改SimpleMemberhip以使用我的表。

I think this may be close to what you are lookign for: http://blog.spontaneouspublicity.com/including-asp-net-simple-membership-tables-as-part-of-your-entity-framework-model I think this shows how to set other tables that the default for use with SimpleMembership

我认为这可能接近你的看法:http://blog.spontaneouspublicity.com/including-asp-net-simple-membership-tables-as-part-of-your-entity-framework-model我认为这显示了如何设置默认使用SimpleMembership的其他表