扩展的MembershipProvider [英] Extending MembershipProvider

查看:82
本文介绍了扩展的MembershipProvider的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情景:

构建应用程序,为企业输入信息。

Building an application for companies to enter information into.

我需要延长在asp.net中内置的成员资格提供程序。我唯一​​的情况是,我已经有每个公司的人口统计学信息,但不对用户标识的密码,并为Web应用程序。我想prepopulate数据库的人口统计信息,发送每个公司独特的针数,并要求他们与我的注册申请。我希望他们能够创建一个用户ID,电子邮件地址和密码后,他们已经通过输入他们收到的邮件引脚验证他们是谁。是的,我们会被送他们,通过普通邮件,以独特的针数。

I need to extend the built-in membership provider in asp.net. My unique situation is that I already have demographic information for each company, but NOT userid's and passwords for a web app. I want to prepopulate the DB with the demographic information, send each company a unique pin number, and ask them to register with my application. I want them to create a userid, email address and password, after they've "validated" who they are by entering the pin number that they received in the mail. Yes, we'd be sending them, via snail mail, a unique pin number.

问题:

不太知道从哪里开始。这个问题回避的事实,我们已经拥有了这些公司的人口统计信息而现在,它不是可以使用这个新的Web应用程序更新人口信息,所以我们真的不希望他们去改变它的中心。我们也不想随便谁都能够注册一个帐号并进入人口信息。

Not quite sure where to start. The problem centers around the fact that we already have demographic information for these companies and right now, it's not possible to use this new web application to update the demographic info, so we really don't want them to change it. We also don't want just anybody being able to register an account and entering demographic information.

问题:

我在想关于这个错误的方式?结果
是扩展成员资格提供给正确的方式去?
什么是处理这种情况的最好方法?

Am I thinking about this the wrong way?
Is extending the membership provider the right way to go? What is the best way to handle this situation?

推荐答案

或延长实现成员资格提供是相当简单的居然和听起来像你的问题的好方法。

Extending or implementing a membership provider is quite straightforward actually, and sounds like a good approach for your problem.

会员供应商,大多数应用程序甚至使用的唯一功能是的ValidateUser 方法。在你的情况,你会简单地覆盖这个方法从数据库中提取客户名称和脚,并与用户的输入匹配。如果匹配,返回true,否则为false。

The only functionality of membership providers that most applications even use is the ValidateUser method. In your case, you would simply override this method to fetch the customer name and pin from the database and match it with the user's input. If it matches, return true, otherwise, false.

创建一个新的类继承的MembershipProvider。右键单击类名和实现抽象方法,以及你去比赛。有很多的演练和例子,如果你谷歌他们。

Create a new class, inherit MembershipProvider. Right click the class name and implement the abstract methods, and you're off to the races. There are lots of walkthroughs and examples if you google for them as well.

这篇关于扩展的MembershipProvider的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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