Partager via


Interface IReportServerCredentials

Permet aux objets de fournir les informations d'identification à utiliser pour la connexion à un serveur de rapports.

Espace de noms :  Microsoft.Reporting.WinForms
Assembly :  Microsoft.ReportViewer.WinForms (en Microsoft.ReportViewer.WinForms.dll)

Syntaxe

'Déclaration
Public Interface IReportServerCredentials
'Utilisation
Dim instance As IReportServerCredentials
public interface IReportServerCredentials
public interface class IReportServerCredentials
type IReportServerCredentials =  interface end
public interface IReportServerCredentials

Le type IReportServerCredentials expose les membres suivants.

Propriétés

  Nom Description
Propriété publique ImpersonationUser Spécifie l'utilisateur dont l'identité doit être empruntée lors de la connexion à un serveur de rapports.
Propriété publique NetworkCredentials Renvoie les informations d'identification réseau à utiliser pour l'authentification sur le serveur de rapports.

Haut de la page

Méthodes

  Nom Description
Méthode publique GetFormsCredentials Fournit l'authentification par formulaires à utiliser pour la connexion au serveur de rapports.

Haut de la page

Exemples

L'exemple suivant montre une implémentation de 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;
    }
}

Voir aussi

Référence

Espace de noms Microsoft.Reporting.WinForms