ReportServerCredentials.SetFormsCredentials 方法 (Cookie, String, String, String)
發行︰ 2016年7月
指定連接到報表伺服器時將使用表單驗證,並提供表單認證。
命名空間: Microsoft.Reporting.WinForms
組件: Microsoft.ReportViewer.WinForms (於 Microsoft.ReportViewer.WinForms.dll)
語法
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 Sub SetFormsCredentials (
authCookie As Cookie,
userName As String,
password As String,
authority As String
)
參數
authCookie
Type: System.Net.Cookie報表伺服器所用的驗證 Cookie。
userName
Type: System.String將用來連接到報表伺服器的使用者名稱。
password
Type: System.String將用來連接到報表伺服器的密碼。
authority
Type: System.String驗證使用者時所用的權限,如 Windows 網域名稱。
範例
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();
}
}
}
另請參閱
ReportServerCredentials 類別
Microsoft.Reporting.WinForms 命名空間
回到頁首