次の方法で共有


ReportServerCredentials.SetFormsCredentials メソッド

レポート サーバーへの接続時にフォーム認証が使用されることを指定し、フォームの資格情報を提供します。

名前空間:  Microsoft.Reporting.WinForms
アセンブリ:  Microsoft.ReportViewer.WinForms (Microsoft.ReportViewer.WinForms.dll 内)

構文

'宣言
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
)

パラメーター

  • authCookie
    型 : Cookie
    レポート サーバーによって使用される認証クッキー。
  • userName
    型 : String
    レポート サーバーへの接続に使用するユーザー名。
  • password
    型 : String
    レポート サーバーへの接続に使用するパスワード。
  • authority
    型 : String
    ユーザーの認証時に使用する Microsoft 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 名前空間