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.
PaulTwo points. What role is your user in? It could be that perhaps you need to
be in a different role to get information about the report than you do to
get a list of reports? It seems to me if it worked for a list of reports
then your login must be OK.
Second issue. For something like this I recommend trying to web forum. The
other MVP is there and is familiar with webservices. Also, that is where MS
people hang out.
http://forums.microsoft.com/msdn/showforum.aspx?forumid=82&siteid=1
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Paul Cheetham" <PAC.News@.dsl.pipex.com> wrote in message
news:%231p4s096HHA.5164@.TK2MSFTNGP05.phx.gbl...
> 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
>|||OK Thanks, I'll post there.
I'm pretty sure the Role is OK, as I know the same user details are
being used successfully in another application, which I am replacing,
but that is just showing the report and is not trying to get the
Parameter list.
Paul
Bruce L-C [MVP] wrote:
> Two points. What role is your user in? It could be that perhaps you need to
> be in a different role to get information about the report than you do to
> get a list of reports? It seems to me if it worked for a list of reports
> then your login must be OK.
> Second issue. For something like this I recommend trying to web forum. The
> other MVP is there and is familiar with webservices. Also, that is where MS
> people hang out.
> http://forums.microsoft.com/msdn/showforum.aspx?forumid=82&siteid=1
>
Monday, March 19, 2012
Logon failed. (rsLogonFailed)
Labels:
application,
attempting,
database,
failed,
logon,
microsoft,
mysql,
oracle,
parameters,
report,
reporting,
rslogonfailed,
server,
services,
sql,
web,
writing
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment