【问题标题】:Getting multiple SQL Reports with HttpWebRequest - 401 Unauthorized使用 HttpWebRequest 获取多个 SQL 报告 - 401 Unauthorized
【发布时间】:2011-11-01 11:07:26
【问题描述】:

我正在尝试调用多个 SQL Reporting Services 报告,取回 .pdf,然后将它们附加在一起。我在附加 .pdf 文件时没有问题,但在第二份报告中出现错误。下面是一些示例代码:

    Dim httpReq As System.Net.HttpWebRequest = DirectCast(System.Net.WebRequest.Create(strLink), System.Net.HttpWebRequest)
    Dim creds As New System.Net.NetworkCredential
    creds.Domain = "MyDomain"
    creds.UserName = "UserName"
    creds.Password = "Password"

    httpReq.Credentials = creds

    Dim httpResp As System.Net.HttpWebResponse = DirectCast(httpReq.GetResponse(), System.Net.HttpWebResponse)
    httpResp.Close()
    httpReq = Nothing
    httpResp = Nothing

    Dim SecondHttpReq As System.Net.HttpWebRequest = DirectCast(System.Net.WebRequest.Create(strSecondLink), System.Net.HttpWebRequest)
    SecondHttpReq.Credentials = creds

    Dim SecondHttpResp As System.Net.HttpWebResponse = DirectCast(SecondHttpReq.GetResponse(), System.Net.HttpWebResponse)

当我尝试创建第二个 HttpResponse 时,我收到 401 Unauthorized 错误。当我检查 SecondHttpReq 对象出错时,我发现 Credentials 属性已被设置回 Nothing。我试过使用 CookieContainer 无济于事。我真的不想写一个父/子报告来把这些放在一起,所以我想听听其他选择。提前致谢。

【问题讨论】:

    标签: vb.net reporting-services


    【解决方案1】:

    已修复。有人在未通知任何人的情况下更改了我们报表服务器的权限。

    【讨论】:

      猜你喜欢
      • 2012-09-06
      • 1970-01-01
      • 2019-11-09
      • 2017-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多