自定义会员提供者和会员用户
我有一个简单的问题。我现在正在考虑为我的应用程序创建自定义会员资格提供程序,因为对会员资格和应用程序的其余部分使用单独的表并不是一个好主意..更不用说一些数据只是沿着表复制..
我想知道,如果我还必须重新实现其他功能,例如检查用户是否在线等等。或者如果我复制部分数据库结构并实现提供程序就足够了?
更新!
我真正想知道的是 MembershipUser 中的方法(例如检查 IF 用户 IsOnline 等)是否适用于自定义数据库模式。
我知道如何实现自定义提供程序,我只是想知道我是否有更多繁琐的工作来实现其他 Membership* 类的功能。
I have simple question. I'm now thinking about creating custom membership provider for my app, because using separate tables for membership and for rest of the app is not that good idea.. not to mention some data is simply replicated along tables..
What I want to know, if I also have to reimplement other functionaly like checking if user is online, and so on. Or it's just enough if i copy part of db structure and implement provider ?
UPDATE!
What I really want to know is the methods from MembershipUser (like checking IF user IsOnline and so on), will work on custom database schema.
I know how to implement custom provider, I just want to know if I have more tedious work implementing functionality from other Membership* classes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将会员资格表和应用程序的其余部分分开不是一个好主意吗?它必须位于不同的表中。也许您的意思是单独的数据库。
无论如何,您不需要实施所有方法。以下是您必须实施的必要方法:
您可以在网上找到数十个示例。一些是:
http://www.asp.net /general/videos/how-do-i-create-a-custom-membership-provider
http://www.davidhayden.com/blog/dave /archive/2007/10/11/CreateCustomMembershipProviderASPNETWebsiteSecurity.aspx
http://www.shiningstar.net/aspnet_articles/customprovider/CustomProvider.aspx
http://www.devx.com/asp/Article/29256/0 /页/3
http://www.15seconds.com/issue/050216.htm
http://www.codeproject.com/KB/aspnet/CustomMembershipProviders.aspx
http://www.codeproject.com/KB/aspnet/WSSecurityProvider.aspx
Separate Tables for membership and for rest of the app is not a good idea? It has to be in a different table. Maybe you meant separate databases.
Any way, you do not need to impolement all methods. Here are the necessary methods you have to implement:
You can find dozens of examples on the net. Some are:
http://www.asp.net/general/videos/how-do-i-create-a-custom-membership-provider
http://www.davidhayden.com/blog/dave/archive/2007/10/11/CreateCustomMembershipProviderASPNETWebsiteSecurity.aspx
http://www.shiningstar.net/aspnet_articles/customprovider/CustomProvider.aspx
http://www.devx.com/asp/Article/29256/0/page/3
http://www.15seconds.com/issue/050216.htm
http://www.codeproject.com/KB/aspnet/CustomMembershipProviders.aspx
http://www.codeproject.com/KB/aspnet/WSSecurityProvider.aspx
您不需要实现完整的 MembershipProvider。只需实现您需要的位,而对于其他未使用的方法则抛出
NotImplementedException
。You don't need to implement the full MembershipProvider. Just implement the bits you need, and for the other unused methods throw a
NotImplementedException
.如果我有一些重写方法,实际上只需要与抽象方法表现相同,那么最好的方法是什么?
例子。
What's the best approach if I have some overriden methods that really just need to behave the same as the abstract method?
Example.