【问题标题】:Sharepoint UserProfileServiceSharepoint 用户配置文件服务
【发布时间】:2010-06-14 02:50:26
【问题描述】:

我有一个共享点站点和一个自定义 aspx 门户,都在 Windows 身份验证下。 在同一台机器上,我的 sharepoint 站点会返回我当前的登录名,而我的自定义 aspx 会返回我的域管理员帐户。

无论如何我可以确保两个登录名相同吗?否则,是否有从自定义 aspx 门户使用 SPUserProfileService 的方法?

主要是,我需要有自定义 aspx 门户来获取共享点登录 ID。尽管如此,我仍然可以在 sharepoint 中触发 AccessDenied.aspx 以提示登录。

【问题讨论】:

    标签: sharepoint session web-services


    【解决方案1】:

    当您说“自定义 ASPX 门户”时,它是否仍托管在 SharePoint 网站上?

    在这种情况下,你如何获得用户?您可以使用 SPContext.Current.Web.CurrentUser 来获取用户。

    【讨论】:

      【解决方案2】:

      您似乎正在使用您的域管理员帐户从您的自定义 aspx 连接到 SharePoint。 您能否详细介绍一下您的自定义 aspx 门户以及您读取用户名的方式?

      不过,您可以查看我的文章(尽管它是针对 FBA 用户的,但您可能会发现代码 sn-p 很有用): Possible ways to get logged in User Name & Handling Changes in FBA Users' Names if Membership Provider Name Changed

      public string GetFlatUserName()
      {
          //First, be sure that the user is not anonymous user:
          if (SPContext.Current == null || SPContext.Current.Web.CurrentUser == null)
              return "Anonymous";
          //Second, parse it:
          else
          {
              string flatUserName = this.Page.User.Identity.Name;
              if (flatUserName.Contains("\\"))
              {
                  flatUserName = flatUserName.Substring(flatUserName.IndexOf("\\") + 1);
              }
              else if (flatUserName.Contains("|"))
              {
                  flatUserName = flatUserName.Substring(flatUserName.IndexOf("|") + 1);
              }
              return flatUserName;
          }
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多