다음을 통해 공유


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 보고서 서버에서 인증을 위해 사용할 네트워크 자격 증명을 반환합니다.

맨 위로 이동

메서드

  이름 설명
공용 메서드 GetFormsCredentials 보고서 서버에 연결하는 데 사용할 폼 인증을 제공합니다.

맨 위로 이동

다음 예에서는 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 네임스페이스