IReportServerCredentials インターフェイス

レポート サーバーへの接続に使用する資格情報をオブジェクトが提供できるようにします。

名前空間:  Microsoft.Reporting.WinForms
アセンブリ:  Microsoft.ReportViewer.WinForms (Microsoft.ReportViewer.WinForms.dll)

構文

'宣言
Public Interface IReportServerCredentials
'使用
Dim instance As IReportServerCredentials
public interface IReportServerCredentials
public interface class IReportServerCredentials
type IReportServerCredentials =  interface end
public interface IReportServerCredentials

IReportServerCredentials 型は、以下のメンバーを公開しています。

プロパティ

  名前 説明
パブリック プロパティ ImpersonationUser レポート サーバーへの接続時に権限を借用するユーザーを指定します。
パブリック プロパティ NetworkCredentials レポート サーバーでの認証に使用するネットワーク資格情報を返します。

Top

メソッド

  名前 説明
パブリック メソッド GetFormsCredentials レポート サーバーへの接続に使用するフォーム認証を提供します。

Top

使用例

次の例は、IReportServerCredentials の実装を示しています。

using System;
using System.Data;
using System.Windows.Forms;
using System.Security.Principal;
using Microsoft.Reporting.WinForms;

class MyCredentials : IReportServerCredentials
{
    public WindowsIdentity ImpersonationUser
    {
        get
        {
            return null;
        }
    }

    public bool GetBasicCredentials(out string user, out string 
password, out string domain)
    {
        user = <UserName>;
        password = <Password>;
        domain = <DomainName>;
        return true;
    }

    public bool GetFormsCredentials(System.Net.Cookie myCookie, out 
string user, out string password, out string authority)
    {
        myCookie = user = password = authority = null;
        return false;
    }
}

public class Demo : Form 
{
    public Demo()
    {
        this.Text = "Report Control Demo";
        this.ClientSize = new System.Drawing.Size(950, 600);

        ReportViewer reportViewer = new ReportViewer();

        // Set Processing Mode.

        reportViewer.ProcessingMode = ProcessingMode.Remote;

        // Set server info.

        reportViewer.ServerReport.ReportServerUrl = new 
Uri("http://<ServerName>/reportserver");
        reportViewer.ServerReport.ReportPath = "/Report 
Project1/Report1";
        reportViewer.ServerReport.ReportServerCredentials = new 
MyCredentials();

        // Add the reportviewer to the form.

        reportViewer.Dock = DockStyle.Fill;
        this.Controls.Add(reportViewer);

        // Process and render the report.

        reportViewer.RefreshReport();
    }

    [STAThread]
    public static int Main(string[] args) 
    {
        Application.Run(new Demo());
        return 0;
    }
}

関連項目

参照

Microsoft.Reporting.WinForms 名前空間