Gets or sets the network credentials used for authentication with the report server.
命名空间: Microsoft.Reporting.WinForms
程序集: Microsoft.ReportViewer.WinForms (在 microsoft.reportviewer.winforms.dll 中)
语法
声明
用法
属性值
A NetworkCredentials object containing the network credentials used for authentication with the report server.
示例
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
namespace ReportServerCredentialsSample
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            reportViewer1.ProcessingMode =
 Microsoft.Reporting.WinForms.ProcessingMode.Remote;
            reportViewer1.ServerReport.ReportPath = 
@"/Adventureworks Sample Reports/Company Sales";
            NetworkCredential myCred = new 
NetworkCredential(<UserName>, <Password>, <DomainName>);
            reportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials =
       myCred;
       
            reportViewer1.RefreshReport();
        }
    }
}
另请参见
参考
ReportServerCredentials 类
ReportServerCredentials 成员
Microsoft.Reporting.WinForms 命名空间