本文為機器翻譯文章。如需檢視英文版,請選取 [原文] 核取方塊。您也可以將滑鼠指標移到文字上,即可在快顯視窗顯示英文原文。
譯文
原文

ReportServerCredentials.NetworkCredentials 屬性

 

發佈時間: 2016年4月

取得或設定用於報表伺服器驗證的網路認證。

命名空間:   Microsoft.Reporting.WinForms
組件:  Microsoft.ReportViewer.WinForms (在 Microsoft.ReportViewer.WinForms.dll 中)

public ICredentials NetworkCredentials { get; set; }

屬性值

Type: System.Net.ICredentials

包含用於報表伺服器驗證之網路認證的 NetworkCredentials 物件。

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();
        }
    }
}
回到頁首
顯示: