[英]In a .NET web app, how can I implement Membership without having to host my own SQL database?
I'm using Amazon Web Services for nearly everything, including their SimpleDB flat database. 我几乎将Amazon Web Services用于所有内容,包括其SimpleDB平面数据库。 It's so nice, stable, reasonably safe, etc.. The moment I begin to add Membership to my web app in .NET, it feels like I have to start becoming a fully-fledged database administrator and backup and manage a SQL database.
它是如此的好,稳定,相当安全等等。从我开始向.NET中的Web应用程序添加成员身份的那一刻,感觉就像我必须开始成为一个成熟的数据库管理员,并备份和管理SQL数据库。
Is there any method for implementing username/password/login/password recovery features on my website without having to host, backup and manage a SQL server myself? 有什么方法可以在我的网站上实现用户名/密码/登录/密码恢复功能,而无需自己托管,备份和管理SQL Server?
Thank you! 谢谢!
---UPDATE---- Found this sample project on AWS that has the basic custom Memebership code. --- UPDATE ----在具有基本自定义Memebership代码的AWS上找到了此示例项目。 It's a great start:
这是一个很好的开始:
http://aws.amazon.com/articles/3592 http://aws.amazon.com/articles/3592
You need to implement custom membership provider. 您需要实现自定义成员资格提供程序。 Take a look at MSDN article - Implementing a Membership Provider and an article - Building Custom Providers for ASP.NET 2.0 Membership .
看一下MSDN文章- 实现成员资格提供程序和文章- 构建ASP.NET 2.0成员资格的自定义提供程序 。
By providing you own MembershipProvider you can abstract the data access. 通过提供您自己的MembershipProvider,您可以抽象化数据访问。
There are two steps for this. 为此,有两个步骤。
One. 一。 In web.config:
在web.config中:
<membership defaultProvider="MyMembershipProvider">
<providers>
<clear/>
<add name="MyMembershipProvider" type="Full.Name.MyMembershipProvider"
more options here/>
</providers>
</membership>
Two. 二。 The membership class.
会员等级。
public sealed class MyMembershipProvider : MembershipProvider {
//... much more here
//example method:
public override bool ChangePassword(string username, string oldPwd, string newPwd)
{
//access simpleDb here
}
}
The good news is that you have to implement only the methods you use, eg if you do registration through other channels then you can get away with only implementing ChangePassword , ValidateUser and Initialize . 好消息是,您只需要实现所使用的方法即可,例如,如果您通过其他渠道进行注册,则只需实现ChangePassword , ValidateUser和Initialize即可 。
Have a look at How to: Sample Membership Provider Implementation (for the class code) and Sample Membership Provider Implementation (for the web.config bit). 看一看如何:示例成员资格提供者实现 (针对类代码)和示例成员资格提供者实现 (针对web.config位)。
有一个带有.net sdk的示例asp.net应用程序,其中包含一个示例simpledb成员资格提供程序类(petboard示例) http://aws.amazon.com/articles/3592
RSSBus provides a SimpleDB data provider (looks free for now): RSSBus提供了一个SimpleDB数据提供程序(目前免费):
http://www.rssbus.net/ado/amazon-simpledb/features.aspx http://www.rssbus.net/ado/amazon-simpledb/features.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.