質問ダウンロードSSRSレポートと特定の場所(C#の)に保存する(不正な)
それは私の選択の名前で特定のフォルダにあります。私は、必要に応じて、これを行うさまざまな方法の提案に公開しています。
問題私は常に関係なく、私が入力した資格情報は、以下のエラー(401)無許可を取得していないのですが
:私はこのコード(C#)を使用しています
An exception of type 'System.Net.WebException' occurred in System.dll but was not handled in user code
Additional information: The remote server returned an error: (401) Unauthorized.
を:
WebClient myWebClient = new WebClient();
NetworkCredential netCredential = new NetworkCredential("username", "password");
myWebClient.Credentials = netCredential;
var theURL = "http://ReportServer/ReportServer_MYSERVER/Pages/ReportViewer.aspx?%2fPurchaseOrder&rs:Command=Render&OrderID=100&rs:ClearSession=true&rs:Format=PDF"
byte[] myDataBuffer = myWebClient.DownloadData(theURL);
例URL(これは単純にコピーすると完全にファイルをダウンロードします私のマシンはドメイン上にあり、これらの資格情報をドメインとデータベースSAアカウントと一緒に試してみましたが、どちらも同じ問題。 「http://www.axmag.com/download/pdfurl-guide.pdf」
ありがとう、すべてこの問題についてのヘルプは、イムは望ん:
私は例えば、私は、インターネットからランダムにURLをハードコーディングされ、これが働いたとして、PDFファイルをダウンロードする際に、このコードは動作します知っています
var theURL = "http://ReportServer/ReportServer_MYSERVER/Pages/ReportViewer.aspx?%2fPurchaseOrder&rs:Command=Render&OrderID=100&rs:ClearSession=true&rs:Format=PDF";
WebClient Client = new WebClient();
Client.UseDefaultCredentials = true;
byte[] myDataBuffer = Client.DownloadData(theURL);
は、このコードは、上記のいずれかのSSRSを可能にします:これは私のアプリケーションに非常に便利なほかになると、これが可能であることを