如何使用NTLM身份验证上的凭据导航到URL?

时间:2019-03-29 04:06:22

标签: c# windows winforms

我计划将凭据传递给WebRequest,然后使用已设置的凭据导航到URL。该凭据不是我的。这是一个SSRS报告。但是我仍然无法使用我设置的用户凭据查看报告。有人可以指导我如何做吗?

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(repUrl);
            request.Method = "GET";
            request.KeepAlive = true;
            request.Accept = @"*/*";
            NetworkCredential credential = new NetworkCredential("username", "password", Environment.UserDomainName);
            CredentialCache credentialCache = new CredentialCache();
            credentialCache.Add(new Uri(repUrl), "NTLM", credential);
            request.Credentials = credentialCache;
            webBrowser1.Navigate(request.RequestUri);

0 个答案:

没有答案