ReportServerCredentials.SetFormsCredentials, méthode
Spécifie que l'authentification par formulaires doit être utilisée lors de la connexion au serveur de rapports et fournit les informations d'identification par formulaires.
Espace de noms : Microsoft.Reporting.WinForms
Assembly : Microsoft.ReportViewer.WinForms (dans Microsoft.ReportViewer.WinForms.dll)
Syntaxe
'Déclaration
Public Sub SetFormsCredentials ( _
authCookie As Cookie, _
userName As String, _
password As String, _
authority As String _
)
public void SetFormsCredentials(
Cookie authCookie,
string userName,
string password,
string authority
)
public:
void SetFormsCredentials(
Cookie^ authCookie,
String^ userName,
String^ password,
String^ authority
)
member SetFormsCredentials :
authCookie:Cookie *
userName:string *
password:string *
authority:string -> unit
public function SetFormsCredentials(
authCookie : Cookie,
userName : String,
password : String,
authority : String
)
Paramètres
- authCookie
Type : Cookie
Cookie d'authentification utilisé par le serveur de rapports.
- userName
Type : String
Nom d'utilisateur qui sera utilisé pour la connexion au serveur de rapports.
- password
Type : String
Mot de passe qui sera utilisé pour la connexion au serveur de rapports.
- authority
Type : String
Autorité à utiliser lors de l'authentification de l'utilisateur (par exemple, nom de domaine Windows).
Exemples
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";
reportViewer1.ServerReport.ReportServerCredentials.SetFormsCredentials(
null, <UserName>, <Password>, <DomainName>);
reportViewer1.RefreshReport();
}
}
}