Delen via


ReportServerCredentials.NetworkCredentials Property

Gets or sets the network credentials used for authentication with the report server.

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

Syntax

'Declaration
Public Property NetworkCredentials As ICredentials
'Usage
Dim instance As ReportServerCredentials
Dim value As ICredentials

value = instance.NetworkCredentials

instance.NetworkCredentials = value
public ICredentials NetworkCredentials { get; set; }
public:
virtual property ICredentials^ NetworkCredentials {
    ICredentials^ get () sealed;
    void set (ICredentials^ value);
}
/** @property */
public final ICredentials get_NetworkCredentials ()

/** @property */
public void set_NetworkCredentials (ICredentials value)
public final function get NetworkCredentials () : ICredentials

public function set NetworkCredentials (value : ICredentials)

Property Value

A NetworkCredentials object containing the network credentials used for authentication with the report server.

Example

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();
        }
    }
}

See Also

Reference

ReportServerCredentials Class
ReportServerCredentials Members
Microsoft.Reporting.WinForms Namespace