IReportServerConnection2 인터페이스
ReportViewer Web Forms 컨트롤을 세션 상태 없이 사용하는 경우 보고서 서버 연결 정보를 제공합니다.
네임스페이스: Microsoft.Reporting.WebForms
어셈블리: Microsoft.ReportViewer.WebForms(Microsoft.ReportViewer.WebForms.dll)
구문
‘선언
Public Interface IReportServerConnection2 _
Inherits IReportServerConnection, IReportServerCredentials
‘사용 방법
Dim instance As IReportServerConnection2
public interface IReportServerConnection2 : IReportServerConnection,
IReportServerCredentials
public interface class IReportServerConnection2 : IReportServerConnection,
IReportServerCredentials
type IReportServerConnection2 =
interface
interface IReportServerConnection
interface IReportServerCredentials
end
public interface IReportServerConnection2 extends IReportServerConnection, IReportServerCredentials
IReportServerConnection2 유형에서 다음 멤버를 표시합니다.
속성
이름 | 설명 | |
---|---|---|
![]() |
Cookies | 보고서 서버로 보낼 사용자 지정 쿠키 컬렉션을 가져옵니다. |
![]() |
Headers | 보고서 서버로 보낼 사용자 지정 머리글의 컬렉션을 가져옵니다. |
![]() |
ImpersonationUser | ReportViewer 컨트롤이 보고서 서버에 연결할 때 가장할 사용자의 System.Security.Principal.WindowsIdentity를 가져오거나 설정합니다. (IReportServerCredentials에서 상속됨) |
![]() |
NetworkCredentials | 보고서 서버 인증에 사용되는 네트워크 자격 증명을 가져오거나 설정합니다. (IReportServerCredentials에서 상속됨) |
![]() |
ReportServerUrl | 보고서 서버의 URL을 반환합니다. (IReportServerConnection에서 상속됨) |
![]() |
Timeout | 서버 통신 대기 시간(밀리초)을 가져옵니다. (IReportServerConnection에서 상속됨) |
맨 위로 이동
메서드
이름 | 설명 | |
---|---|---|
![]() |
GetFormsCredentials | 폼 인증용으로 구성된 보고서 서버 연결에 사용되는 정보를 제공합니다. (IReportServerCredentials에서 상속됨) |
맨 위로 이동
주의
IReportServerConnection2 인터페이스의 구현이 Web.config 설정에 지정된 경우 ServerReport 인스턴스의 ReportServerUrl, Timeout, Cookies 및 Headers 속성에 대한 값이 사용되지 않습니다. 대신 IReportServerConnection2 구현에 의해 제공되는 값이 사용됩니다. 이러한 속성 외에 IReportServerConnection2 구현에 의해 제공되는 자격 증명 정보도 사용됩니다.
ReportViewer 컨트롤에 대해 연결을 지정하는 방법은 ReportViewer 웹 서버 컨트롤에 대한 연결 및 자격 증명 지정을 참조하십시오.
ReportViewerServerConnection Web.config 설정에 대한 자세한 내용은 ReportViewer에 대한 Web.config 설정을 참조하십시오.
예
다음 예제에서는 Web.config 파일에서 보고서 서버 URL 및 자격 증명 정보를 검색하는 IReportServerConnection2 인터페이스의 구현을 제공합니다.
예제를 사용하려면 응용 프로그램의 Web.config 파일에 있는 appSettings 블록에 ReportViewerServerConnection, MyReportViewerUser, MyReportViewerPassword, MyReportViewerDomain 및 MyReportServerUrl이라는 5개의 키/값 쌍을 추가해야 합니다. 여기서 값은 보고서 서버에 연결하기 위한 사용자 이름, 암호 및 도메인과 보고서 서버의 URL에 해당합니다. IReportServerConnection2 클래스 구현의 정규화된 어셈블리 이름으로 ReportViewerServerConnection 값을 설정해야 합니다.
Web.config ReportViewerServerConnection 설정에 대한 자세한 내용은 ReportViewer에 대한 Web.config 설정을 참조하십시오.
public sealed class MyReportServerConnection : IReportServerConnection2
{
public WindowsIdentity ImpersonationUser
{
get
{
// Use the default Windows user. Credentials will be
// provided by the NetworkCredentials property.
return null;
}
}
public ICredentials NetworkCredentials
{
get
{
// Read the user information from the web.config file.
// By reading the information on demand instead of
// storing it, the credentials will not be stored in
// session, reducing the vulnerable surface area to the
// web.config file, which can be secured with an ACL.
// User name
string userName =
ConfigurationManager.AppSettings
["MyReportViewerUser"];
if (string.IsNullOrEmpty(userName))
throw new Exception(
"Missing user name from Web.config file");
// Password
string password =
ConfigurationManager.AppSettings
["MyReportViewerPassword"];
if (string.IsNullOrEmpty(password))
throw new Exception(
"Missing password from Web.config file");
// Domain
string domain =
ConfigurationManager.AppSettings
["MyReportViewerDomain"];
if (string.IsNullOrEmpty(domain))
throw new Exception(
"Missing domain from Web.config file");
return new NetworkCredential(userName, password, domain);
}
}
public bool GetFormsCredentials(out Cookie authCookie,
out string userName, out string password,
out string authority)
{
authCookie = null;
userName = null;
password = null;
authority = null;
// Not using form credentials
return false;
}
public Uri ReportServerUrl
{
get
{
string url =
ConfigurationManager.AppSettings[
"MyReportServerUrl"];
if (string.IsNullOrEmpty(url))
throw new Exception(
"Missing url from the Web.config file");
return new Uri(url);
}
}
public int Timeout
{
get
{
return 60000; // 60 seconds
}
}
public IEnumerable<Cookie> Cookies
{
get
{
// No custom cookies
return null;
}
}
public IEnumerable<string> Headers
{
get
{
// No custom headers
return null;
}
}
}
Public NotInheritable Class MyReportServerConnection
Implements IReportServerConnection2
Public ReadOnly Property ImpersonationUser() As WindowsIdentity _
Implements IReportServerConnection2.ImpersonationUser
Get
'Use the default Windows user. Credentials will be
'provided by the NetworkCredentials property.
Return Nothing
End Get
End Property
Public ReadOnly Property NetworkCredentials() As ICredentials _
Implements IReportServerConnection2.NetworkCredentials
Get
'Read the user information from the web.config file.
'By reading the information on demand instead of storing
'it, the credentials will not be stored in session,
'reducing the vulnerable surface area to the web.config
'file, which can be secured with an ACL.
'User name
Dim userName As String = _
ConfigurationManager.AppSettings("MyReportViewerUser")
If (String.IsNullOrEmpty(userName)) Then
Throw New Exception("Missing user name from web.config file")
End If
'Password
Dim password As String = _
ConfigurationManager.AppSettings("MyReportViewerPassword")
If (String.IsNullOrEmpty(password)) Then
Throw New Exception("Missing password from web.config file")
End If
'Domain
Dim domain As String = _
ConfigurationManager.AppSettings("MyReportViewerDomain")
If (String.IsNullOrEmpty(domain)) Then
Throw New Exception("Missing domain from web.config file")
End If
Return New NetworkCredential(userName, password, domain)
End Get
End Property
Public Function GetFormsCredentials(ByRef authCookie As Cookie, _
ByRef userName As String, _
ByRef password As String, _
ByRef authority As String) _
As Boolean _
Implements IReportServerConnection2.GetFormsCredentials
authCookie = Nothing
userName = Nothing
password = Nothing
authority = Nothing
'Not using form credentials
Return False
End Function
Public ReadOnly Property ReportServerUrl() As Uri
Implements IReportServerConnection2.ReportServerUrl
Get
Dim url As String = ConfigurationManager.AppSettings("MyReportViewerUrl")
If (String.IsNullOrEmpty(url)) Then
Throw New Exception("Missing url from the web.config file")
End If
Return New Uri(url)
End Get
End Property
Public ReadOnly Property Timeout() As Integer Implements IReportServerConnection2.Timeout
Get
Return 60000 '60 seconds
End Get
End Property
Public ReadOnly Property Cookies() As IEnumerable(Of Cookie) Implements IReportServerConnection2.Cookies
Get
Return Nothing
End Get
End Property
Public ReadOnly Property Headers() As IEnumerable(Of String) Implements IReportServerConnection2.Headers
Get
Return Nothing
End Get
End Property
End Class
참고 항목
참조
Microsoft.Reporting.WebForms 네임스페이스