Reputation: 10296
I have a SSRS 2008 R2 report running on the reporting server. When I access the report using the Report Manager or Web Service URL it works ok.
http://mycomputer/ReportServer
and
http://mycomputer/Reports
When I add a ReportViewer to a WebForms web site and point it to
http://mycomputer/reportserver
with a report path to my report it gives me an access denied error when running the web site using VS.net's web server.
The permissions granted to user 'mycomputer\myusername' are insufficient for performing this operation. (rsAccessDenied)
The following is the exact code I'm using in the aspx page.
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" ProcessingMode="Remote" Font-Names="Verdana"
Font-Size="8pt" InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana"
WaitMessageFont-Size="14pt" Width="712px">
<ServerReport ReportPath="/MyReports" ReportServerUrl="http://mycomputer/reportserver" />
</rsweb:ReportViewer>
mycomputer \ myusername is an Adminstrator on the machine. I also added it as an Administrator in the ReportManager.
I am running it using IE in Administrator mode.
What else could be causing the access denied issues?
I've read other people having issues, but most of them are not for 2008R2 so I haven't been able to figure out how to try what they did. There is no IIS to configure and no IUSR to give access to the reports.
SSRS logs just show the same error message without any other information.
Upvotes: 2
Views: 1844
Reputation: 6045
Creating an instance class that implements IReportServerCredentials should fix the problem. Add the following class and call it as follows:
ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials("username", "pwd", "domain");
/// <summary>
/// Local implementation of IReportServerCredentials
/// </summary>
public class ReportServerCredentials : IReportServerCredentials
{
private string _userName;
private string _password;
private string _domain;
public ReportServerCredentials(string userName, string password, string domain)
{
_userName = userName;
_password = password;
_domain = domain;
}
public WindowsIdentity ImpersonationUser
{
get
{
// Use default identity.
return null;
}
}
public ICredentials NetworkCredentials
{
get
{
// Use default identity.
return new NetworkCredential(_userName, _password, _domain);
}
}
public bool GetFormsCredentials(out Cookie authCookie, out string user, out string password, out string authority)
{
// Do not use forms credentials to authenticate.
authCookie = null;
user = password = authority = null;
return false;
}
}
Thanks to Phil Clewes: link
Upvotes: 2