Wednesday, March 28, 2012

ReportViewer Connection to Remote Server

Hello,
I have a ReportViewer placed in a webform in remote mode and am having a
difficult time getting it to connect to a remote 2005 Report Server.
I can connect to the report manager remotely; however, all my attempts at
connnecting a reportviewer to that same Report Server has failed.
I believe it has something to do with impersonation but everything I see is
in c# and I use vb.net.
A step by step tutorial using VB.NET would be great but I have been unable
to locate any.
Any suggestions?
Thanks,
JohnHello Steven,
>What's the error messge you got in the
> reportviewer control at runtime, is it a message indicate that the current
> security context doesn't have sufficient permission?
The request failed with HTTP status 401: Unauthorized.
> 1. Is the SSRS reportserver installed with default setting?(using
> integrated windows security in IIS) Also, have you ever customized the
> role based security setting of the certain report you want to access in
> reportviewer?
The SSRS is using integrated windows security in IIS and I have not
customized any role-based security in the report.
> 2. What's OS and IIS version of your ASP.NET web application's host
> machine? Is it IIS 5 or IIS6. If you haven't manually configured to use
> impersonate for your ASP.NET application, the reportViewer page will run
> under your ASP.NET application's process identity and use this identity to
> access the remote reportserver. For IIS6, ASP.NET process identity is
> configured in the application pool identity and the default value is "NT
> AUTHORITY\NETWORK SERVICE". As for IIS5, is still use the machine.config's
> <processModel> section for setting ASP.NET process identity and the default
> value is machine\ASPNET. The following msdn article also described on
> configuring ASP.NET process identity:
> #Configuring ASP.NET Process Identity
> http://msdn2.microsoft.com/en-us/library/dwc1xthy.aspx
> And in your page you can use the following code snippet to printout the
> current security identity:
> =============> protected void Page_Load(object sender, EventArgs e)
> {
> Response.Write("<br/>Identity: " +
> System.Security.Principal.WindowsIdentity.GetCurrent().Name);
> }
> =============
I am currently developing on a WinXP Pro OS and trying to connect to the
SSRS 2005 on a Windows 2003 Standard OS. I will eventually need to move my
application to a production web server that is running Windows 2003 Web
Edition and connecting to a SSRS 2005 installation on a remote Windows
Standard 2003 server.
I tried changing the identity in the machine.config; however, no matter what
I change it to I get a response.write computername\mywindowsloginname when I
run in the integrated file based development environment. If I launch it from
IIS5 I get computername\ASPNET.
I can not go any further in your steps until I get this resolved.
Thanks,
John
"Steven Cheng[MSFT]" wrote:
> Hello John,
> Thank you for posting in the MSDN newsgroup.
> From your description, I understand you're developing an ASP.NET
> application which use the webform reportViewer control to access and
> display some server-reports from the SSRS 2005 reportserver. However, you
> found that the reportviewer always failed to connect to the
> reportserver(server report), correct? If there is anything I missed, please
> feel free to let me know.
> As for this problem, based on my experience, it is likely cause by security
> permission setting issue. What's the error messge you got in the
> reportviewer control at runtime, is it a message indicate that the current
> security context doesn't have sufficient permission? First, I'd like to
> confrim some environment info about the problem server machine and the
> reportserver with you:
> 1. Is the SSRS reportserver installed with default setting?(using
> integrated windows security in IIS) Also, have you ever customized the
> role based security setting of the certain report you want to access in
> reportviewer?
> 2. What's OS and IIS version of your ASP.NET web application's host
> machine? Is it IIS 5 or IIS6. If you haven't manually configured to use
> impersonate for your ASP.NET application, the reportViewer page will run
> under your ASP.NET application's process identity and use this identity to
> access the remote reportserver. For IIS6, ASP.NET process identity is
> configured in the application pool identity and the default value is "NT
> AUTHORITY\NETWORK SERVICE". As for IIS5, is still use the machine.config's
> <processModel> section for setting ASP.NET process identity and the default
> value is machine\ASPNET. The following msdn article also described on
> configuring ASP.NET process identity:
> #Configuring ASP.NET Process Identity
> http://msdn2.microsoft.com/en-us/library/dwc1xthy.aspx
> And in your page you can use the following code snippet to printout the
> current security identity:
> =============> protected void Page_Load(object sender, EventArgs e)
> {
> Response.Write("<br/>Identity: " +
> System.Security.Principal.WindowsIdentity.GetCurrent().Name);
> }
> =============>
> 3. After you've detect and ensure the running security identity of your
> ASP.NET application(the one reportviewer will use to access the remote
> report server). You can consider the role based permission setting on the
> remote reportServer. First, you should check whether the security identity
> can be identified and recognized on the remote reportserver machine. for
> example, the "NT AUTHORITY\NETWORK SERVICE" account is recognized as the
> machine's account on remote machine in windows domain. After you've
> verified that the identity can be recognized as a valid account on the
> remote reportserver, you should grant that account the sufficient
> permission to access that report. Generally, since we only view the report,
> so the "browser" role is sufficient. You can grant certain user/group one
> or more roles through the ReportManager or SQL Server management studio.
> Here are some resources on SSRS 2005 role based security managment:
> #Using Role-Based Security
> http://msdn2.microsoft.com/en-us/library/ms156014.aspx
> #Role Assignments
> http://msdn2.microsoft.com/en-us/library/ms156406.aspx
> #Creating, Modifying, and Deleting Role Definitions
> http://msdn2.microsoft.com/en-us/library/ms156264.aspx
> And I've also attached a screenshot of the role management interface in the
> ReportManager web application(grant a certain user with certain role).
> If you have anything unclear on the above things or if there is any further
> questions, please feel free to let me know.
> Sincerely,
> Steven Cheng
> Microsoft MSDN Online Support Lead
>
> ==================================================> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
> ications.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial
> response from the community or a Microsoft Support Engineer within 1
> business day is
> acceptable. Please note that each follow up response may take approximately
> 2 business days
> as the support professional working with you may need further investigation
> to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require
> urgent, real-time or phone-based interactions or complex project analysis
> and dump analysis
> issues. Issues of this nature are best handled working with a dedicated
> Microsoft Support
> Engineer by contacting Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/default.aspx.
> ==================================================>
> This posting is provided "AS IS" with no warranties, and confers no rights|||Hello John,
Thanks for your response.
From your further description, I've got that your current development
machine is a winxp box and the error you got is a "401 unauthorized" error.
I think this is due to the security identity passed from your XP dev box is
not recognizable in the reportserver machine(2003 test server). Here is my
understanding and analysis on the following symptom you described:
===============I tried changing the identity in the machine.config; however, no matter
what
I change it to I get a response.write computername\mywindowsloginname when
I
run in the integrated file based development environment. If I launch it
from
IIS5 I get computername\ASPNET.
===============
At first, when you change different identities in the machine.config, since
you're developing through the VS 2005 built-in tes webserver/File system
based project), the ASP.NET application is always running in the test
server and will run under your current logon user accountand.(That's why
you always see the "computername\mylogonuser") Thus, the reportViewer will
use this identity to access remote server report, surely this local account
is not valid on the remote reportserver machine(different machine) and the
IIS windows authentication will fail with 401.
Again, when you host the ASP.NET application in IIS, it will use the
ASP.NET worker process identity which is configured in the <processModel>
element in machine.config, and by default it is "machine\ASPNET". And this
account is also a machine specfic local account, therefore it is also
invalid when the reportviewer use the it to access the remote reportserver.
To resolve this, you can consider the following possible means:
1. When deveoping use Test web server, logon with a domain account (have
sufficient permission on the devbox) which is also recognizable on the
remote reportserver machine. This require that both machines are in the
same local domain.
2. Still developing use the test webserver, and still logon with a local
account. However, you need to create a duplicated local account on the
remote reportserver machine(with the same username and password). This can
make your local account on XP dev machine also recognizable(be
authenticated) on the remote reportserver machine. This is a workable
solution for all windows system use NTLM authentication.
3. If you will use IIS host ASP.NET application, then just change the
account in the <processModel> element in machine.config. And which account
to use also reference to the #1 and #2
BTW, when you finally move the ASP.NET application to a windows 2003
server, since IIS6 use application pool to configure worker process
identity and it use "NetworkService" account by default(this account is
recognized as the server's machine account on other remote machines in the
same domain), it'll be eaiser for you to configure the security setting if
your machines are in a domain environment.
Please feel free to let me know if there is anything unclear or if you
still have any other concerns on this.
Regards,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may
learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hello Steven,
I added a user account to the remote server with my local machine's username
and password. I gave that user Administrative priveledges. Also, my local and
my remote computers are on two seperate domains.
I am no longer getting the error:
The request failed with HTTP status 401: Unauthorized.
I am now getting the following error:
The attempt to connect to the report server failed. Check your connection
information and that the report server is a compatible version.
The request failed with HTTP status 404: Not Found.
If I change the password on the remote server to be different than my local
password, I once again get the 401 unauthorized error. It therefore seems to
me that I am little farther.
What would you suggest?
Thanks,
John
"Steven Cheng[MSFT]" wrote:
> Hello John,
> Thanks for your response.
> From your further description, I've got that your current development
> machine is a winxp box and the error you got is a "401 unauthorized" error.
> I think this is due to the security identity passed from your XP dev box is
> not recognizable in the reportserver machine(2003 test server). Here is my
> understanding and analysis on the following symptom you described:
> ===============> I tried changing the identity in the machine.config; however, no matter
> what
> I change it to I get a response.write computername\mywindowsloginname when
> I
> run in the integrated file based development environment. If I launch it
> from
> IIS5 I get computername\ASPNET.
> ===============> At first, when you change different identities in the machine.config, since
> you're developing through the VS 2005 built-in tes webserver/File system
> based project), the ASP.NET application is always running in the test
> server and will run under your current logon user accountand.(That's why
> you always see the "computername\mylogonuser") Thus, the reportViewer will
> use this identity to access remote server report, surely this local account
> is not valid on the remote reportserver machine(different machine) and the
> IIS windows authentication will fail with 401.
> Again, when you host the ASP.NET application in IIS, it will use the
> ASP.NET worker process identity which is configured in the <processModel>
> element in machine.config, and by default it is "machine\ASPNET". And this
> account is also a machine specfic local account, therefore it is also
> invalid when the reportviewer use the it to access the remote reportserver.
>
> To resolve this, you can consider the following possible means:
> 1. When deveoping use Test web server, logon with a domain account (have
> sufficient permission on the devbox) which is also recognizable on the
> remote reportserver machine. This require that both machines are in the
> same local domain.
> 2. Still developing use the test webserver, and still logon with a local
> account. However, you need to create a duplicated local account on the
> remote reportserver machine(with the same username and password). This can
> make your local account on XP dev machine also recognizable(be
> authenticated) on the remote reportserver machine. This is a workable
> solution for all windows system use NTLM authentication.
> 3. If you will use IIS host ASP.NET application, then just change the
> account in the <processModel> element in machine.config. And which account
> to use also reference to the #1 and #2
> BTW, when you finally move the ASP.NET application to a windows 2003
> server, since IIS6 use application pool to configure worker process
> identity and it use "NetworkService" account by default(this account is
> recognized as the server's machine account on other remote machines in the
> same domain), it'll be eaiser for you to configure the security setting if
> your machines are in a domain environment.
> Please feel free to let me know if there is anything unclear or if you
> still have any other concerns on this.
> Regards,
> Steven Cheng
> Microsoft MSDN Online Support Lead
>
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may
> learn and benefit from your issue.
> ==================================================>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>
>
>|||Thanks for your followup John,
I thank we've made some progress on this. As you can find the remote server
now correctly recognize and validate the user on your cilent dev machine
and no longer display the 401 error, you can also check the IIS server's
log to see whether it list the client user's username in the request log
entry.
For the new problem you mentioned, I think it is somewhat specific to the
reportServer (server-side configuration). Have you tried directly use the
IE browser to visit that report in reportserver(not reportManager)? And
you can test by using the same account as you developed in VS IDE to access
that server report in IE browser(on XP dev box ) to see whether it report
the same error. The reportserver's url is like below by default:
Http://servername/reportserver/
Please let me know what you get on this. If convenient, you can also attach
some screenshot on the error.
Looking forward to your reply.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hello Steven,
I have no problems connecting to the remote ReportServer or ReportManager
from a browser.
Thanks,
John
"Steven Cheng[MSFT]" wrote:
> Thanks for your followup John,
> I thank we've made some progress on this. As you can find the remote server
> now correctly recognize and validate the user on your cilent dev machine
> and no longer display the 401 error, you can also check the IIS server's
> log to see whether it list the client user's username in the request log
> entry.
> For the new problem you mentioned, I think it is somewhat specific to the
> reportServer (server-side configuration). Have you tried directly use the
> IE browser to visit that report in reportserver(not reportManager)? And
> you can test by using the same account as you developed in VS IDE to access
> that server report in IE browser(on XP dev box ) to see whether it report
> the same error. The reportserver's url is like below by default:
> Http://servername/reportserver/
> Please let me know what you get on this. If convenient, you can also attach
> some screenshot on the error.
> Looking forward to your reply.
> Sincerely,
> Steven Cheng
> Microsoft MSDN Online Support Lead
>
> ==================================================>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>|||Thanks for your reply John,
Since you can visit the reportserver correctly through webbrowser, the
problem should be specific to the reportviewer control. Based on my
investigation, the reportViewer control internally use a pregenerated
webservice proxy to call the reportserver's webservice (the ReportService
and ReportExecutionService), so we may perform some test against the
webservice call to the remote reportserver. To do this, you can still use
your ASP.NET web application (running under the certain user account that
has mapped account on remote server), add the webreference to the reporting
service webservice:
#Report Server Web Service
http://msdn2.microsoft.com/en-us/library/ms152787.aspx
You can reference the two main reporting service webservices through the
following two endpoints under the reportserver web root:
ReportService2005.asmx
ReportExecution2005.asmx
So, the url will be like:
http://servername/reportserver/ReportService2005.asmx or
http://servername/reportserver/ReportExecution2005.asmx
Please try calling some methods on it to see whether your ASP.NET
application can correctly consume the webmethods. You can also check the
reportserver's log files to see what's the error generated when your client
ASP.NET application fails to access it.
BTW, I've also found some other former issue which had the similar symptom
with yours. In those cases, their reportServer application's IIS virtual
directory or IIS site is using a custom host header(dosn't use the default
website/machine name). And we need to check the some URL settings(like the
reportserver virtual directory, UrlRoot ...) in the
RsWebApplication.config file, you can find those setting in the following
BOL reference:
#RSWebApplication Configuration File
http://msdn2.microsoft.com/en-us/library/ms155878.aspx
Based on my local test, the <UrlRoot> element in the rsreportserver.config
file should be conform to your reportserver's external url(to other
machines).
<UrlRoot>http://myservermachine/reportserver</UrlRoot>
the file is under the reportserver application directory(C:\Program
Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer)
Here are some related threads over the internet discussing on the similar
issue:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=256312&SiteID=1
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=256312&SiteID=1
Hope this helps. If you there is anything unclear or have any further
question, please feel free to post here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||Steven,
I too am having the same problem. I''m getting the error: The request failed
with HTTP status 401: Unauthorized.
I'm very sure this is happening because I am not passing my Credentials to
the ReportViewer Control. I cannot seem to get the syntax correct.
Here is how I did it using the rs.render method:
Dim strUserName_Dev As String =System.Configuration.ConfigurationManager.AppSettings("UserName_Dev")
Dim strPWD_Dev As String =System.Configuration.ConfigurationManager.AppSettings("PWD_Dev")
Dim strDomain_Dev As String =System.Configuration.ConfigurationManager.AppSettings("Domain_Dev")
RS.Credentials = New System.Net.NetworkCredential(strUserName_Dev,
strPWD_Dev, strDomain_Dev)
Dim data As Byte()
data = RS_Dev.Render(Path2, Format, Nothing, Nothing, Parameters, _
Nothing, Nothing, Encoding, MimeType,
ParametersUsed, _
Warnings, StreamIDs)
The above methods works very well when I'm sending the output to a binary
stream or writer.
I need to now use the ReportViewer Control.
Can you please help me assign the same credentials to the ReportViewer
Control? I cannot figure out the syntax. Here is what I'm trying:
Getting the credentials:
RS.Credentials = New System.Net.NetworkCredential(strUserName_Dev,
strPWD_Dev, strDomain_Dev)
ReportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials =RS.credentials
I get a compile error telling me this is a Read Only Property.
I'm not sure what to do next.
Thanks,
Rwiethorn
"Steven Cheng[MSFT]" wrote:
> Thanks for your reply John,
> Since you can visit the reportserver correctly through webbrowser, the
> problem should be specific to the reportviewer control. Based on my
> investigation, the reportViewer control internally use a pregenerated
> webservice proxy to call the reportserver's webservice (the ReportService
> and ReportExecutionService), so we may perform some test against the
> webservice call to the remote reportserver. To do this, you can still use
> your ASP.NET web application (running under the certain user account that
> has mapped account on remote server), add the webreference to the reporting
> service webservice:
> #Report Server Web Service
> http://msdn2.microsoft.com/en-us/library/ms152787.aspx
> You can reference the two main reporting service webservices through the
> following two endpoints under the reportserver web root:
> ReportService2005.asmx
> ReportExecution2005.asmx
> So, the url will be like:
> http://servername/reportserver/ReportService2005.asmx or
> http://servername/reportserver/ReportExecution2005.asmx
> Please try calling some methods on it to see whether your ASP.NET
> application can correctly consume the webmethods. You can also check the
> reportserver's log files to see what's the error generated when your client
> ASP.NET application fails to access it.
> BTW, I've also found some other former issue which had the similar symptom
> with yours. In those cases, their reportServer application's IIS virtual
> directory or IIS site is using a custom host header(dosn't use the default
> website/machine name). And we need to check the some URL settings(like the
> reportserver virtual directory, UrlRoot ...) in the
> RsWebApplication.config file, you can find those setting in the following
> BOL reference:
> #RSWebApplication Configuration File
> http://msdn2.microsoft.com/en-us/library/ms155878.aspx
> Based on my local test, the <UrlRoot> element in the rsreportserver.config
> file should be conform to your reportserver's external url(to other
> machines).
> <UrlRoot>http://myservermachine/reportserver</UrlRoot>
> the file is under the reportserver application directory(C:\Program
> Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer)
> Here are some related threads over the internet discussing on the similar
> issue:
>
> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=256312&SiteID=1
> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=256312&SiteID=1
> Hope this helps. If you there is anything unclear or have any further
> question, please feel free to post here.
> Sincerely,
> Steven Cheng
> Microsoft MSDN Online Support Lead
> ==================================================>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>|||Hello Steven,
I still haven't had any luck; however, the Report Services was not set up to
a default install. I am going to reinstall and see if that helps.
Thanks,
John
"Steven Cheng[MSFT]" wrote:
> Thanks for your reply John,
> Since you can visit the reportserver correctly through webbrowser, the
> problem should be specific to the reportviewer control. Based on my
> investigation, the reportViewer control internally use a pregenerated
> webservice proxy to call the reportserver's webservice (the ReportService
> and ReportExecutionService), so we may perform some test against the
> webservice call to the remote reportserver. To do this, you can still use
> your ASP.NET web application (running under the certain user account that
> has mapped account on remote server), add the webreference to the reporting
> service webservice:
> #Report Server Web Service
> http://msdn2.microsoft.com/en-us/library/ms152787.aspx
> You can reference the two main reporting service webservices through the
> following two endpoints under the reportserver web root:
> ReportService2005.asmx
> ReportExecution2005.asmx
> So, the url will be like:
> http://servername/reportserver/ReportService2005.asmx or
> http://servername/reportserver/ReportExecution2005.asmx
> Please try calling some methods on it to see whether your ASP.NET
> application can correctly consume the webmethods. You can also check the
> reportserver's log files to see what's the error generated when your client
> ASP.NET application fails to access it.
> BTW, I've also found some other former issue which had the similar symptom
> with yours. In those cases, their reportServer application's IIS virtual
> directory or IIS site is using a custom host header(dosn't use the default
> website/machine name). And we need to check the some URL settings(like the
> reportserver virtual directory, UrlRoot ...) in the
> RsWebApplication.config file, you can find those setting in the following
> BOL reference:
> #RSWebApplication Configuration File
> http://msdn2.microsoft.com/en-us/library/ms155878.aspx
> Based on my local test, the <UrlRoot> element in the rsreportserver.config
> file should be conform to your reportserver's external url(to other
> machines).
> <UrlRoot>http://myservermachine/reportserver</UrlRoot>
> the file is under the reportserver application directory(C:\Program
> Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer)
> Here are some related threads over the internet discussing on the similar
> issue:
>
> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=256312&SiteID=1
> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=256312&SiteID=1
> Hope this helps. If you there is anything unclear or have any further
> question, please feel free to post here.
> Sincerely,
> Steven Cheng
> Microsoft MSDN Online Support Lead
> ==================================================>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>|||Thanks for your followup John,
I think the non-default installed location of the webservice could be the
potential cause as the configuration file of reportserver contains some
settings that identitfy the webservice's url(virtual directory or server
url).
Before you performing the reinstall, I still suggest you have a look at the
following threads and tried the settings mentioned there:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=256312&SiteID=1
#Installing Microsoft SQL Server 2005 Reporting Services on a non-default
web site.
http://www.mathgv.com/sql2005docs/SQL2005ReportingServicesInstall.htm
Hope that also helps.
If you meet any further problem or need any assistance, please feel free to
let me know.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hello Rwiethorn,
Yes, 401 error indicate that the supplied credential (security identity) is
not valid. What's your client appilcation(calling the SSRS webservice)'s
type, winform or asp.net? You can first try changing your client
appliation's security identity to a valid account which is recognizable on
the remote server to see whether it works.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.|||Steven Thanks for your response.
To answer your questions:
>What's your client application(calling the SSRS webservice)'s type, winform or
asp.net?
Its an ASP.NET application.
>You can first try changing your client applicationâ's security identity to a valid account which is recognizable on the remote server to see whether it works.
I've done that using the SOAP API Render method, and rendering the report to
a Response Object works perfectly. (Response.BinaryWrite(data))
When I use the SOAP method, I assign credentials to the RS object via this
method:
RS.Credentials = New System.Net.NetworkCredential(â'MyNameâ', â'MyPWDâ',
â'MyDomainâ')
Then proceed to assign the other propeties ie: parameters, and call the
Render method of the RS object as so:
data = RS.Render(Path2, Format, Nothing, Nothing, Parameters, Nothing,
Nothing, Encoding, MimeType, ParametersUsed, Warnings, StreamIDs)
When I try to use the ReportViewer Control, Iâ'm getting an error: â'Unable to
cast object of type 'System.Net.NetworkCredential' to type
'Microsoft.Reporting.WebForms.IReportServerCredentials'â'. From the following
lines of code:
Dim RC As New NetworkCredential("strUserName_Dev", "strPWD_Dev",
"strDomain_Dev")
ReportViewer1.ServerReport.ReportServerCredentials = RC
ReportViewer1.ServerReport.ReportPath = "/PA/CASNO_with_UNASSIGNED"
ReportViewer1.ServerReport.Refresh()
Iâ've also tried:
Dim CC As New System.Net.CredentialCache
CC.Add(New
Uri("http://bdcintra557.internal.pg.com/ReportServer$SQL2005/ReportService.asmx"),
"Digest", New System.Net.NetworkCredential("strUserName_Dev", "strPWD_Dev",
"strDomain_Dev"))
ReportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials = CC
ReportViewer1.ServerReport.ReportPath = "/PA/CASNO_with_UNASSIGNED"
ReportViewer1.ServerReport.Refresh()
But I get an error trying to assign the CredentialCache to the ReporViewer
Control: Property 'NetworkCredentials' is 'ReadOnly'
I need help to assign these same NetworkCredentials to the ReportViewer
Control.
I just donâ't know the VB syntax to do it; Iâ'm not a very strong programmer.
Thanks,
Robert Wiethorn
rwiethorn
"Steven Cheng[MSFT]" wrote:
> Hello Rwiethorn,
> Yes, 401 error indicate that the supplied credential (security identity) is
> not valid. What's your client appilcation(calling the SSRS webservice)'s
> type, winform or asp.net? You can first try changing your client
> appliation's security identity to a valid account which is recognizable on
> the remote server to see whether it works.
> Sincerely,
> Steven Cheng
> Microsoft MSDN Online Support Lead
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>|||Hello Robert,
AS for the ReportViewer's Credential property, you can not directly use the
System.Net.NetworkCredential class, you need to implement a custom
IReportCredential interface's concrete class. Here is a previous thread in
which I've provided a sample IReportCredential implementation:
http://groups.google.com/group/microsoft.public.sqlserver.reportingsvcs/brow
se_thread/thread/359cd6fce6f3ab37/dadf62fe2aed9f87?lnk=st&q=&rnum=1&hl=en#da
df62fe2aed9f87
In addition, do you think it's also possible that we programmatically
imerpsonate the ASP.NET worker thread as a specific user(which has
sufficient permission on the remote server)? If so, you can
programmtically impersonate in the reportviewer page (as a specific
account) so that you do not need to implement a custom ReportCredential
class. For programmtic impersonate in ASP.NET, please refer to the
following kb:
#How to implement impersonation in an ASP.NET application
http://support.microsoft.com/kb/306158/en-us
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.|||Steven,
Thanks for the info, and all I can say is wow, thats going deep, but I got
it to work, I'll paste the code that I found after following a couple of
links:
Public Class MyReportViewerCredentials
Implements IReportServerCredentials
Private _userName As String
Private _password As String
Private _domain As String
Public Sub New(ByVal userName As String, ByVal password As String, ByVal
domain As String)
_userName = userName
_password = password
_domain = domain
End Sub
Public ReadOnly Property ImpersonationUser() As
System.Security.Principal.WindowsIdentity Implements
Microsoft.Reporting.WebForms.IReportServerCredentials.ImpersonationUser
Get
Return Nothing
End Get
End Property
Public ReadOnly Property NetworkCredentials() As System.Net.ICredentials
Implements
Microsoft.Reporting.WebForms.IReportServerCredentials.NetworkCredentials
Get
Return New Net.NetworkCredential(_userName, _password, _domain)
End Get
End Property
Public Function GetFormsCredentials(ByRef authCookie As
System.Net.Cookie, ByRef userName As String, ByRef password As String, ByRef
authority As String) As Boolean Implements
Microsoft.Reporting.WebForms.IReportServerCredentials.GetFormsCredentials
userName = _userName
password = _password
authority = _domain
Return Nothing
End Function
End Class
I then call that class in using:
ReportViewer1.ServerReport.ReportServerCredentials = New
MyReportViewerCredentials(strUserName_Dev, strPWD_Dev, strDomain_Dev)
ReportViewer1.ServerReport.Refresh()
Here is the link I found:
http://forums.asp.net/thread/1271383.aspx
Thanks for the help.
rwiethorn
"Steven Cheng[MSFT]" wrote:
> Hello Robert,
> AS for the ReportViewer's Credential property, you can not directly use the
> System.Net.NetworkCredential class, you need to implement a custom
> IReportCredential interface's concrete class. Here is a previous thread in
> which I've provided a sample IReportCredential implementation:
> http://groups.google.com/group/microsoft.public.sqlserver.reportingsvcs/brow
> se_thread/thread/359cd6fce6f3ab37/dadf62fe2aed9f87?lnk=st&q=&rnum=1&hl=en#da
> df62fe2aed9f87
> In addition, do you think it's also possible that we programmatically
> imerpsonate the ASP.NET worker thread as a specific user(which has
> sufficient permission on the remote server)? If so, you can
> programmtically impersonate in the reportviewer page (as a specific
> account) so that you do not need to implement a custom ReportCredential
> class. For programmtic impersonate in ASP.NET, please refer to the
> following kb:
> #How to implement impersonation in an ASP.NET application
> http://support.microsoft.com/kb/306158/en-us
> Hope this helps.
> Sincerely,
> Steven Cheng
> Microsoft MSDN Online Support Lead
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>|||Thanks for the followup Robert,
Glad that you've got it working.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead|||Hello Steven,
I finally got this to work.
I had to change the Report Server URL to http://IPADDRESS/Reportserver from
http://IPADDRESS/Reports
I also was then able to set my credentials up using the information from
Rwiethorn's posts.
Thank you for the help.
John
"Steven Cheng[MSFT]" wrote:
> Thanks for your followup John,
> I think the non-default installed location of the webservice could be the
> potential cause as the configuration file of reportserver contains some
> settings that identitfy the webservice's url(virtual directory or server
> url).
> Before you performing the reinstall, I still suggest you have a look at the
> following threads and tried the settings mentioned there:
> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=256312&SiteID=1
>
> #Installing Microsoft SQL Server 2005 Reporting Services on a non-default
> web site.
> http://www.mathgv.com/sql2005docs/SQL2005ReportingServicesInstall.htm
>
> Hope that also helps.
> If you meet any further problem or need any assistance, please feel free to
> let me know.
>
> Sincerely,
> Steven Cheng
> Microsoft MSDN Online Support Lead
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>|||Hi John,
Thanks for the followup and glad that you've got it working.
Have a good day!
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

No comments:

Post a Comment