我正在使用WebClient从C#创建SSRS报告 . 但是当我尝试下载文件时,这给了我异常 the remote server returned an error (401) unauthorized . 我有谷歌它但没有得到任何结果来解决这个问题 .

URl我参考Stack overflow Question和第二个链接Stack overflow Question 2 for my reference . 能帮我解决这个问题吗?

private void OpenSSRSLabel(int ordId) {
     try {
         string ReportURL = "http://MySERVER/ReportServer/Pages/ReportViewer.aspx?%2fSystem%2fWebOrderEntry_Label&ORDERNUM=";
         if (_orderDAC == null)
             _orderDAC = new OrderDAC();
             DataTable _dt = _orderDAC.GetOderByID(ordId);
             string FileURL = ReportURL + _dt.Rows[0]["ORDERNUM"].ToString() + "&rs:Command=Render&rs:Format=PDF";

             string filename = string.Format("OrderLabel{0}.pdf", DateTime.Now.ToString("dd-H-mmss"));

             string file = Server.MapPath("~/Temp/" + filename);
             if (System.IO.File.Exists(file)) {
                 File.Delete(file);
             }

             // Implement in Live Server
             WebClient client = new WebClient();


             client.Credentials = new NetworkCredential("MYSERVER\\Admin", "C47");
             client.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
             client.DownloadFile(FileURL, file);  // Exception 


             string path = Page.ResolveClientUrl("~/Temp/" + filename);
             ScriptManager.RegisterStartupScript(Page, typeof(System.Web.UI.Page), "OpenWindow", "window.open('" + path + "');", true);
    }
    catch (Exception ex) {

    }
}