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");
}
然后,在MembershipProvider的ValidateUser函数中,确保执行以下检查:
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;
}
对于需求#2,我感到有些困惑。究竟什么是操作员?我以为我们在处理一部使用网络浏览器浏览网站的手机。操作员在哪里?如果我上面提出的解决方案没有帮助,请发布一个回复,提供有关运营商的更多详细信息。