Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在撤销Web部件Sharepoint 2003的Web应用时进行身份验证_C#_Asp.net_Sharepoint_Web Parts_Sharepoint 2003 - Fatal编程技术网

C# 在撤销Web部件Sharepoint 2003的Web应用时进行身份验证

C# 在撤销Web部件Sharepoint 2003的Web应用时进行身份验证,c#,asp.net,sharepoint,web-parts,sharepoint-2003,C#,Asp.net,Sharepoint,Web Parts,Sharepoint 2003,还有sharepoint 2003。开发Web部件 当用户访问web部件时,会在服务器端通过身份验证 我需要在Web部件中向Web应用发送请求。当我向部署Web app的服务器发送请求时,尝试登录部署Web部件的服务器帐户 当我向服务器发送一个请求时,我需要一个用于验证访问Web部件的用户帐户的Web应用程序 身份验证类型:NTLM Web部件如何转到访问Web部件的用户名的Web应用程序 找到了两种可能的解决方案: 1.在WebPart中添加Web.config,内容如下: 此代码在以下链

还有sharepoint 2003。开发Web部件

当用户访问web部件时,会在服务器端通过身份验证

我需要在Web部件中向Web应用发送请求。当我向部署Web app的服务器发送请求时,尝试登录部署Web部件的服务器帐户

当我向服务器发送一个请求时,我需要一个用于验证访问Web部件的用户帐户的Web应用程序

身份验证类型:NTLM

Web部件如何转到访问Web部件的用户名的Web应用程序


找到了两种可能的解决方案:

1.在WebPart中添加Web.config,内容如下:

此代码在以下链接中获取:

这没有帮助。原因尚不清楚


这两种情况的原因是什么?

找到了答案——为什么第二种变体不起作用

当您模拟用户时,您可以访问本地资源 用户,但不是远程资源

如何使用第一个选项解决问题

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
    <authentication mode="Windows" />
    <identity impersonate="true" />
  </system.web>
</configuration>
        WindowsIdentity winId = (WindowsIdentity)Context.User.Identity;
        WindowsImpersonationContext ctx = null;

        try
        {
            // Start impersonating.
            ctx = winId.Impersonate();
            // Now impersonating.
            // Access resources using the identity of the authenticated user.
            _autocompleteService.SendParametersForAutoComplete(_loger,
                        new KeyValuePairString("performerId", performerId),
                        new KeyValuePairString("templatePath",
                                                StringConverter.EncodeToURL(templatePath)),
                        new KeyValuePairString("specificationId", specificationId),
                        new KeyValuePairString("buyerId", buyerId),
                        new KeyValuePairString("performerCompanyId", performerCompanyId),
                        new KeyValuePairString("reestrItemId", reestrItemId),
                        new KeyValuePairString("sessionId", sessionId));
        }
        // Prevent exceptions from propagating.
        catch
        {
        }
        finally
        {
            if (ctx != null) ctx.Undo();
        }