P
Phils
Hello guys;
I
i have just found the solution to my problem but would like to full
understand
the solution so would be great full if you could enlighten me.
OUR Set-up
Server A = <WEBSERVER>
SERVER B = <SQLServer & ReportingServer>
Both in workgroups(but on the same domain) behind firewall.
user logs into website, request a client report.
connection made to webserver <Server A>
webserver quiers Reporting Server <Server B>
Reporting Server quiers SQLServer <Server B>
Report Displayed in client browser
Topic A:
Web.config file on Server A
<identity impersonate="true" userName="userX"
password="userXpassword"/>
Q) am i right in thinking with this setting in your web.config file you
will be
impersonating userX that has been setup on Server B and assigned the
proper rights.
Topic B:
Passing credential as opposed to impersonating userX
(Using form authentication to log users in - checking against user
table in database)
Q) Basically the user will select a report, once this selection is made
the parameter collection is queried to
get the required parameters for the report using this collection the
appropriate control values are
taken from the controls on the web page. to make system more secure i
would prefer to pass the credentials from within the
code. from my reading i figured that i have to
1) create a credentialcache and populate with user info i.e.
code:
Dim report As String = strReportPath & strReportName
Dim forRendering As Boolean = False
Dim historyID As String = Nothing
Dim values As webServ.ParameterValue() = Nothing
Dim credentials As webServ.DataSourceCredentials() =
Nothing
Dim parameters As webServ.ReportParameter() = Nothing
'Create an instance of the CredentialCache class.
Dim cache As Net.CredentialCache = New
Net.CredentialCache()
'Add a NetworkCredential instance to CredentialCache.
'Negotiate for NTLM or Kerberos authentication.
cache.Add(New Uri(rs.Url), "Negotiate", New
Net.NetworkCredential("userX", "userXPassword", "domain"))
rs.PreAuthenticate =True
'Assign CredentialCache to the Web service Client
Proxy(myProxy) Credetials property.
rs.Credentials = cache
' get parameter
parameters = rs.GetReportParameters(report, historyID,
forRendering, values, credentials)
2) create a credential class that implements
'Microsoft.Reporting.WebForms' = (ReportVererCredentials) i.e
code:
dim clsObj as New ReportVererCredentials("userX",
"userXPassword", "domain")
ReportViewer1.ServerReport.ReportServerCredentials =
clsObj
I cant understand why i have to pass the credential twice in two
different ways. but if i don't i get an "401 error access denied"
as i said this code now works but im not sure if im am doing things
correctly can you advise.
Topic C
I have a test web server that i use to run the website and it works
fine on that but when i move the same code to
my Main web server i get an error on the line
dim clsObj as New ReportVererCredentials("userX", "userXPassword",
"domain")
COMPLIE ERROR MESSAGE: BC30002 Type 'ReportVererCredentials' is not
defined.
any ideas what this is, am i declaring the class
'ReportVererCredentials' properly
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Public Class UserObj
Private Shared intID As Integer
Public Shared Property ID() As Integer
Get
Return intID
End Get
Set(ByVal value As Integer)
intID = value
End Set
End Property
Private Shared strUserName As String
Public Shared Property UserName() As String
Get
Return strUserName
End Get
Set(ByVal value As String)
strUserName = value
End Set
End Property
Private Shared intPermission As Integer
Public Shared Property Permission() As Integer
Get
Return intPermission
End Get
Set(ByVal value As Integer)
intPermission = value
End Set
End Property
Private Shared intClientID As Integer
Public Shared Property ClientID() As Integer
Get
Return intClientID
End Get
Set(ByVal value As Integer)
intClientID = value
End Set
End Property
Private Shared intEnabled As Integer
Public Shared Property Enabled() As Integer
Get
Return intEnabled
End Get
Set(ByVal value As Integer)
intEnabled = value
End Set
End Property
End Class
i also have the
<add assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
in the web.config file
a lot I know but your help most appreciated
phil.
I
i have just found the solution to my problem but would like to full
understand
the solution so would be great full if you could enlighten me.
OUR Set-up
Server A = <WEBSERVER>
SERVER B = <SQLServer & ReportingServer>
Both in workgroups(but on the same domain) behind firewall.
user logs into website, request a client report.
connection made to webserver <Server A>
webserver quiers Reporting Server <Server B>
Reporting Server quiers SQLServer <Server B>
Report Displayed in client browser
Topic A:
Web.config file on Server A
<identity impersonate="true" userName="userX"
password="userXpassword"/>
Q) am i right in thinking with this setting in your web.config file you
will be
impersonating userX that has been setup on Server B and assigned the
proper rights.
Topic B:
Passing credential as opposed to impersonating userX
(Using form authentication to log users in - checking against user
table in database)
Q) Basically the user will select a report, once this selection is made
the parameter collection is queried to
get the required parameters for the report using this collection the
appropriate control values are
taken from the controls on the web page. to make system more secure i
would prefer to pass the credentials from within the
code. from my reading i figured that i have to
1) create a credentialcache and populate with user info i.e.
code:
Dim report As String = strReportPath & strReportName
Dim forRendering As Boolean = False
Dim historyID As String = Nothing
Dim values As webServ.ParameterValue() = Nothing
Dim credentials As webServ.DataSourceCredentials() =
Nothing
Dim parameters As webServ.ReportParameter() = Nothing
'Create an instance of the CredentialCache class.
Dim cache As Net.CredentialCache = New
Net.CredentialCache()
'Add a NetworkCredential instance to CredentialCache.
'Negotiate for NTLM or Kerberos authentication.
cache.Add(New Uri(rs.Url), "Negotiate", New
Net.NetworkCredential("userX", "userXPassword", "domain"))
rs.PreAuthenticate =True
'Assign CredentialCache to the Web service Client
Proxy(myProxy) Credetials property.
rs.Credentials = cache
' get parameter
parameters = rs.GetReportParameters(report, historyID,
forRendering, values, credentials)
2) create a credential class that implements
'Microsoft.Reporting.WebForms' = (ReportVererCredentials) i.e
code:
dim clsObj as New ReportVererCredentials("userX",
"userXPassword", "domain")
ReportViewer1.ServerReport.ReportServerCredentials =
clsObj
I cant understand why i have to pass the credential twice in two
different ways. but if i don't i get an "401 error access denied"
as i said this code now works but im not sure if im am doing things
correctly can you advise.
Topic C
I have a test web server that i use to run the website and it works
fine on that but when i move the same code to
my Main web server i get an error on the line
dim clsObj as New ReportVererCredentials("userX", "userXPassword",
"domain")
COMPLIE ERROR MESSAGE: BC30002 Type 'ReportVererCredentials' is not
defined.
any ideas what this is, am i declaring the class
'ReportVererCredentials' properly
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Public Class UserObj
Private Shared intID As Integer
Public Shared Property ID() As Integer
Get
Return intID
End Get
Set(ByVal value As Integer)
intID = value
End Set
End Property
Private Shared strUserName As String
Public Shared Property UserName() As String
Get
Return strUserName
End Get
Set(ByVal value As String)
strUserName = value
End Set
End Property
Private Shared intPermission As Integer
Public Shared Property Permission() As Integer
Get
Return intPermission
End Get
Set(ByVal value As Integer)
intPermission = value
End Set
End Property
Private Shared intClientID As Integer
Public Shared Property ClientID() As Integer
Get
Return intClientID
End Get
Set(ByVal value As Integer)
intClientID = value
End Set
End Property
Private Shared intEnabled As Integer
Public Shared Property Enabled() As Integer
Get
Return intEnabled
End Get
Set(ByVal value As Integer)
intEnabled = value
End Set
End Property
End Class
i also have the
<add assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
in the web.config file
a lot I know but your help most appreciated
phil.