gpt4 book ai didi

c# - 我如何知道您已登录 Sharepoint 网页?

转载 作者:行者123 更新时间:2023-11-30 15:13:07 27 4
gpt4 key购买 nike

我们在工作中使用 Sharepoint 作为网页的 CMS。我知道如何创建只有在使用以下命令登录 SharePoint 后才可见的控件:





但我想知道如何根据权限以编程方式使控件可见(或其他)。

我不能使用 .NET windows 窗体身份验证方法,例如:

        if (!(HttpContext.Current.User == null) && HttpContext.Current.User.Identity.IsAuthenticated){}

因为我们将此用于具有其他登录类型的匿名用户。

你能提供一些代码吗?我知道它必须类似于验证 SPContext.Current.FormContext。

最佳答案

如何对用户进行身份验证?使用表单例份验证或 Windows/事件目录?

如果是事件目录,那么我认为在那种情况下您可能需要获取对当前 SPWeb 的引用,然后执行 web.CurrentUser.ID。当您匿名时,这可能会出现空值。如果没有,请尝试 web.SiteUsers.GetByID(web.CurrentUser.ID) 并查看结果。

关于c# - 我如何知道您已登录 Sharepoint 网页?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/380804/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com