为移动用户构建一个新的移动Web平台,以便在其手机上购买和下载内容。在过去,我们使用了一种完全定制的登录机制,但我正在研究使用自定义成员资格提供程序来实现平台的下一个版本。
问题是,我们有一些稍微奇怪的“登录”机制要求,所以我不能百分之百肯定MembershipProvider是最合适的。
只是想得到一些关于以下要求的一般性反馈:“是的,会员服务提供商是一个很合适的人”或“不,你在圆孔里敲一个正方形的钉子”
要求
Implementation
ValidateUser(string username, string password)方法,。
要求2和3是有点奇怪。我们基本上有三个不同的登录机制,一个成员提供者将需要满足。
任何人都可以从上面得到任何评论/反馈,或者对您过去做过的任何奇怪的成员提供者实现都有任何建议。
发布于 2009-07-06 19:40:03
我觉得能行。我们在我们的一个网站上做第三项。下面是我们用来处理它的代码块。为此,创建一个登录页面(transparentlogin.aspx或类似的内容),确保web.config文件允许匿名访问该页面,并将类似的代码放入transparentlogin.aspx页面的page_load函数中:
const string specialpassword = "ThisIsOurSpecialPasswordForBehindTheScenesLogin";
if (MobileNumberFoundInHeader())
{
string username = GetMobileNumberFromHeaders();
// Authenticate the user behind the scenes
System.Web.Security.FormsAuthentication.SetAuthCookie(username, false);
System.Web.Security.FormsAuthentication.Authenticate(username, specialpassword);
}
else
{
throw new Exception ("Mobile Number Missing");
}然后,在ValidateUser函数中的MembershipProvider中,确保执行如下检查:
public override bool ValidateUser(string username, string password)
{
const string specialpassword = "ThisIsOurSpecialPasswordForBehindTheScenesLogin";
bool ValidationSuccess = false;
// If the password being passed in is the right secret key (same
// for all users), then we will say that the password matches the
// username, thus allowing the user to login
if (password == specialpassword)
{
ValidationSuccess = true;
}
if (DoStandardUsernamePasswordVerification() == true)
{
ValidationSuccess = true;
}
return ValidationSuccess;
}至于第二项要求,我有点困惑。接线员到底是什么?我以为我们是在用手机,用网络浏览器浏览网站。接线员在哪里?如果我提出的解决方案没有帮助,请张贴更多关于运营商的详细信息的回复。
时间
https://stackoverflow.com/questions/915141
复制相似问题