IReportServerCredentials Interface
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

IReportServerCredentials Interface 

Allows objects to provide credentials to use for connecting to a report server.

Namespace: Microsoft.Reporting.WinForms
Assembly: Microsoft.ReportViewer.WinForms (in microsoft.reportviewer.winforms.dll)

public interface IReportServerCredentials
public interface IReportServerCredentials
public interface IReportServerCredentials

The following example shows an implementation of IReportServerCredentials.

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

class MyCredentials : IReportServerCredentials
    public WindowsIdentity ImpersonationUser
            return null;

    public bool GetBasicCredentials(out string user, out string 
password, out string domain)
        user = "johndoe";
        password = "mypassword";
        domain = "MyDomain";
        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 
        reportViewer.ServerReport.ReportPath = "/Report 
        reportViewer.ServerReport.ReportServerCredentials = new 

        // Add the reportviewer to the form.

        reportViewer.Dock = DockStyle.Fill;

        // Process and render the report.


    public static int Main(string[] args) 
        Application.Run(new Demo());
        return 0;
© 2015 Microsoft