【问题标题】:Calling web service with current users credentials from SharePoint使用来自 SharePoint 的当前用户凭据调用 Web 服务
【发布时间】:2023-04-09 18:29:01
【问题描述】:

当我从我的 vs2010 客户端运行此 C# 代码时,它可以像我一样进行身份验证。

但是,如果我将代码部署到 web 服务器上的 sharePoint 页面,我会从 web 服务中收到身份验证错误。

我了解这个双跳问题,我需要冒充。也许代码正在以 SharePoint 服务用户的身份调用 Web 服务。

除了硬编码凭据之外,还有什么简单的方法吗?

Uri uri = new Uri("http://tempuri.org/"); 
ICredentials credentials = CredentialCache.DefaultCredentials; 
NetworkCredential credential = credentials.GetCredential(uri, "Basic"); 
Service service = new Service("https://xxx/Exchange.asmx", credential);

有人建议使用带有模拟的 windowsidentity 类,但不知道如何插入。

谢谢。

【问题讨论】:

    标签: .net web-services iis credentials impersonation


    【解决方案1】:

    如果您被信任使用应用程序池身份与您的远程 Web 服务进行交互,那么您可以使用此技术:

    http://mindsharpblogs.com/todd/archive/2005/05/03/467.html

    【讨论】:

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