P
Paul Cheetham
Hi,
I am writing a web application in c# that is attempting to get the
parameters from a report on a Reporting Services 2005 server.
I am using the following code:
SQLReportViewer.ServerReport.ReportServerCredentials = new
ReportCredentials(UserName, UserPassword, UserDomain);
SQLReportViewer.ServerReport.ReportPath = Rpt.FileName;
SQLReportViewer.ServerReport.ReportServerUrl = new Uri(ServerUrl);
Parameters = SQLReportViewer.ServerReport.GetParameters();
The Getparameters Line causes the following exception:
Microsoft.Reporting.WebForms.ReportServerException was unhandled by user
code
Message="Logon failed. (rsLogonFailed)"
Source="Microsoft.ReportViewer.WebForms"
ErrorCode="rsLogonFailed"
StackTrace:
at Microsoft.Reporting.WebForms.ServerReport.get_Service()
at Microsoft.Reporting.WebForms.ServerReport.GetExecutionInfo()
at Microsoft.Reporting.WebForms.ServerReport.GetParameters()
The UserName, UserPassword and UserDomain variables are all populated
with correct data, as is Rpt.FileName.
The ReportCredentials class is a very simple implementation of the
ICredentials interface - Code shown here:
-->
public class ReportCredentials : IReportServerCredentials
{
protected string _UserName, _Password, _Domain;
public ReportCredentials(string UserName, string Password, string Domain)
{
_UserName = UserName;
_Password = Password;
_Domain = Domain;
}
//*****************************************************************
public bool GetFormsCredentials (out System.Net.Cookie AuthCookie,
out string UserName, out string Password, out string Authority)
{
UserName = _UserName;
Password = _Password;
Authority = _Domain;
AuthCookie = null;
return (true);
}
//*****************************************************************
public System.Security.Principal.WindowsIdentity ImpersonationUser
{
get { return (null); }
}
//*****************************************************************
public ICredentials NetworkCredentials
{
get{ return (new NetworkCredential(_UserName, _Password, _Domain)); }
}
<--
I can use the same credentials to retrieve a list of reports from the
report server (the report I am trying to access is in that list) and to
log on directly by going to the URL of Reporting Services.
This is made more frustrating by the complete lack of detail in the
error message, as it does not say why the logon failed, or give me a
single clue about what is going on.
Has anyone seen this before and can tell me how to fix it, or is there
something stupid in my code?
Thankyou.
Paul
I am writing a web application in c# that is attempting to get the
parameters from a report on a Reporting Services 2005 server.
I am using the following code:
SQLReportViewer.ServerReport.ReportServerCredentials = new
ReportCredentials(UserName, UserPassword, UserDomain);
SQLReportViewer.ServerReport.ReportPath = Rpt.FileName;
SQLReportViewer.ServerReport.ReportServerUrl = new Uri(ServerUrl);
Parameters = SQLReportViewer.ServerReport.GetParameters();
The Getparameters Line causes the following exception:
Microsoft.Reporting.WebForms.ReportServerException was unhandled by user
code
Message="Logon failed. (rsLogonFailed)"
Source="Microsoft.ReportViewer.WebForms"
ErrorCode="rsLogonFailed"
StackTrace:
at Microsoft.Reporting.WebForms.ServerReport.get_Service()
at Microsoft.Reporting.WebForms.ServerReport.GetExecutionInfo()
at Microsoft.Reporting.WebForms.ServerReport.GetParameters()
The UserName, UserPassword and UserDomain variables are all populated
with correct data, as is Rpt.FileName.
The ReportCredentials class is a very simple implementation of the
ICredentials interface - Code shown here:
-->
public class ReportCredentials : IReportServerCredentials
{
protected string _UserName, _Password, _Domain;
public ReportCredentials(string UserName, string Password, string Domain)
{
_UserName = UserName;
_Password = Password;
_Domain = Domain;
}
//*****************************************************************
public bool GetFormsCredentials (out System.Net.Cookie AuthCookie,
out string UserName, out string Password, out string Authority)
{
UserName = _UserName;
Password = _Password;
Authority = _Domain;
AuthCookie = null;
return (true);
}
//*****************************************************************
public System.Security.Principal.WindowsIdentity ImpersonationUser
{
get { return (null); }
}
//*****************************************************************
public ICredentials NetworkCredentials
{
get{ return (new NetworkCredential(_UserName, _Password, _Domain)); }
}
<--
I can use the same credentials to retrieve a list of reports from the
report server (the report I am trying to access is in that list) and to
log on directly by going to the URL of Reporting Services.
This is made more frustrating by the complete lack of detail in the
error message, as it does not say why the logon failed, or give me a
single clue about what is going on.
Has anyone seen this before and can tell me how to fix it, or is there
something stupid in my code?
Thankyou.
Paul