迁移从定制表用户ASP.NET成员资格表 [英] Migrate users from custom table to ASP.NET Membership tables

查看:121
本文介绍了迁移从定制表用户ASP.NET成员资格表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个新的中间层,我们所有的客户端调用会经过一个WCF服务。我们以验证用户使用ASP.NET成员资格的服务。中间层会被击中,我们已经有一个包含用户名和密码的InetUsers表中现有的数据库。

I'm creating a new middle tier where all of our client calls will go through a WCF service. We're using ASP.NET membership with the service in order to authenticate users. The middle tier will be hitting an existing database in which we already have an InetUsers table containing usernames and passwords.

这就是它开始变得混乱。直到我们在将来的某个时候把它改写 - - 使用旧的COM +中间层,这个新的中层将由我们的web应用程序通过我们现有的桌面应用程序,这将被使用,但并非如此。用户在Web应用程序的管理发生在桌面应用程序。换言之,将创建的用户和密码设置,并从桌面应用程序,而这又击中现有InetUsers表内变化。

This is where it starts to get messy. This new middle tier will be used by our web application, but not by our existing desktop application, which will - until we rewrite it at some point in the future - be using the old COM+ middle tier. Administration of the users for the web application takes place in the desktop application. In other words, users will be created and passwords set and changed from within the desktop application, which in turn hits the already existing InetUsers table.

在理想情况下,会发生什么是,当我们部署新的中间层,我们将采取一切从InetUsers表的用户,在aspnet_Users和aspnet_Membership为他们创造的记录。然后,我们将在InetUsers表设置触发保持aspnet_Users和aspnet_Membership了最新的。

Ideally, what will happen is when we deploy the new middle tier, we'll take all of the users from the InetUsers table and create records for them in aspnet_Users and aspnet_Membership. Then we'll set a trigger on the InetUsers table to keep aspnet_Users and aspnet_Membership up-to-date.

还有一大堆在这个包裹起来的问题,所以我会尽力,并列出他们都在这里:

There's a whole bunch of questions wrapped up in this, so I'll try and list them all out here:


  • 这是正确的做法?显然,有两个地方这个数据并不理想,但请记住这里,我不是最终的决策者在这里和我们还挺坚持一些遗留的东西在这里,至少现在是这样。尽管如此 - 也许有更好的方法。
  • 在同样 - 那我们会更好的编码我们自己的成员提供程序,而不是使用SqlMembershipProvider的?有多难/易是它这样做?
  • 如果我们使用这种方法,我打算使用aspnet_Membership_XXXX存储程序表的初始群体,以及在触发器。已经做了一些研究,这一点,看来,如果我想从SQL(即触发...)直接调用aspnet_Membership_CreateUser而不是使用API​​,我一定要保存明文密码,因为我不能让盐和哈希正确,否则。这是真的?
  • 是否有任何的这甚至是有意义还是我要对这个错误的方式开始?
  • Is this the right approach? Obviously having this data in two places isn't ideal, but bear in mind here that I'm not the final decision maker here and we're kinda stuck with some legacy stuff here, at least for now. Still - maybe there's a better way.
  • In the same vein - would we be better off coding our own membership provider rather than using the SqlMembershipProvider? How difficult/easy is it to do so?
  • If we use this approach, I plan on using the aspnet_Membership_XXXX stored procedures for the initial population of the tables as well as in the triggers. Having done some research into this, it appears that if I want to call aspnet_Membership_CreateUser directly from SQL (ie in a trigger...) rather than using the API, I have to store clear text passwords since I can't get the salt and the hash right otherwise. Is this true?
  • Does any of this even make sense or am I going about this the wrong way to begin with?

大部分AP preciation任何帮助提供的。

Much appreciation for any help offered.

推荐答案

如果你已经有一个数据库结构,我会写一个自定义的成员提供并跳过现有的成员结构。您使用的一个数据库的结构,开发人员已经用,这样,无论是用于数据访问,报告,或其他目的。创建从的MembershipProvider继承的类。检查了这一点: http://msdn.microsoft.com/en-us/library /f1kyba5e.aspx HTTP://www.devx。 COM / ASP /条/ 29256/0 /页/ 3

If you already have a database structure, I would write a custom membership provider and skip the existing membership structure. That way you are using one database structure that the developers are already used to, whether for data access, reporting, or other purposes. Create a class that inherits from MembershipProvider. Check this out: http://msdn.microsoft.com/en-us/library/f1kyba5e.aspx or http://www.devx.com/asp/Article/29256/0/page/3.

您只需要实现你真正需要的功能。

You only need to implement the features you actually need.

这篇关于迁移从定制表用户ASP.NET成员资格表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆