Siteserver-用户接口-用户验证:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
无编辑摘要
无编辑摘要
 
第29行: 第29行:
|-
|-
! <i>bool</i>
! <i>bool</i>
| <em>true:</em>用户验证成功<br>
| <em>true:</em>用户验证成功<br><em>false:</em>用户验证失败,失败原因存储在errorMessage中<br>
      <em>false:</em>用户验证失败,失败原因存储在errorMessage中<br>
|}
|}



2010年6月15日 (二) 21:32的最新版本

导航: 上一页

用户验证

  • bool ValidateUser(string userName , string password , out string errorMessage)

函数参数

参数 含义
string userName 用户名
string password 密码
out string errorMessage 验证失败时返回的错误信息

返回值

含义
bool true:用户验证成功
false:用户验证失败,失败原因存储在errorMessage中

本接口函数用于用户的登录验证,用户名及密码正确无误则返回true,否则返回false,并将相应的错误信息存储在errorMessage中。

用户验证示例

string errorMessage = string.Empty;
if (!UserFactory.Instance.ValidateUser(userName, password, out errorMessage))
{
    this.ltlErrorMessage.Text = errorMessage;
}
else
{
    string userID = UserFactory.Instance.GetUserID(userName);
    UserFactory.Instance.Login(userID, true);
}


参考资料[ ]