ReportServerCredentials.SetFormsCredentials Method
Specifies that forms authentication is to be used when connecting to the report server and provides the forms credentials.
Namespace: Microsoft.Reporting.WinForms
Assembly: Microsoft.ReportViewer.WinForms (in microsoft.reportviewer.winforms.dll)
Syntax
'Declaration
Public Sub SetFormsCredentials ( _
authCookie As Cookie, _
userName As String, _
password As String, _
authority As String _
)
'Usage
Dim instance As ReportServerCredentials
Dim authCookie As Cookie
Dim userName As String
Dim password As String
Dim authority As String
instance.SetFormsCredentials(authCookie, userName, password, authority)
public void SetFormsCredentials (
Cookie authCookie,
string userName,
string password,
string authority
)
public:
void SetFormsCredentials (
Cookie^ authCookie,
String^ userName,
String^ password,
String^ authority
)
public void SetFormsCredentials (
Cookie authCookie,
String userName,
String password,
String authority
)
public function SetFormsCredentials (
authCookie : Cookie,
userName : String,
password : String,
authority : String
)
Parameters
- authCookie
An authentication cookie used by the report server.
- userName
The user name that will be used to connect to the report server.
- password
The password that will be used to connect to the report server.
- authority
The authority to use when authenticating the user, for example, a Windows domain name.
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";
reportViewer1.ServerReport.ReportServerCredentials.SetFormsCredentials(
null, <UserName>, <Password>, <DomainName>);
reportViewer1.RefreshReport();
}
}
}
See Also
Reference
ReportServerCredentials Class
ReportServerCredentials Members
Microsoft.Reporting.WinForms Namespace