0

使用下面的代码我无法登录页面。当我使用 passwordFormat="Encrypted" 时如何验证用户

if (SPClaimsUtility.AuthenticateFormsUser(ctxUri, txtUserName.Value.Trim(), encodedPassword))
           {
              string strDirectLink = "/Pages/Home.aspx";
              SPUtility.Redirect(strDirectLink.ToString(), SPRedirectFlags.Trusted, HttpContext.Current);
           }
           else
           {
              lblErrMsg.Text = "Invalid username. Please try again";
           }

总是在其他部分执行代码并显示“无效的用户名。请重试”消息。

我的 CA+WP+STS web.config 文件

4

1 回答 1

0

SPClaimsUtility.AuthenticateFormsUser 确实适用于验证用户。您可以在 MembershipRequest.cs 中查看它在 SharePoint 2010 FBA 包中的使用。 https://sharepoint2010fba.codeplex.com

确保您可以首先从基于 SharePoint 表单的登录页面使用该用户名和密码登录,以确保您的成员资格 web.config 设置没有问题。

我一般不建议使用“加密”作为密码格式。开始工作可能很困难,因为您必须确保在所有 SharePoint 服务器上使用相同的密钥,否则它将无法解密密码。

我建议使用 Hashed 的密码格式。它比加密更安全,因为它无法解密为原始密码。它也不需要在所有服务器上设置相同的密钥。

于 2013-06-28T18:40:43.410 回答