I'm building an ASP .NET web application that contains a viewer for SQL Server reports. The viewer is supplied by the Microsoft.ReportingServices.ReportViewerControl.WebForms package.
When connecting using localhost the report appears fine, but when connecting using a domain name (www.example.com) this text appears instead:
The permissions granted to user 'hardcodeddomain\hardcodeduser' are insufficient for performing this operation. (rsAccessDenied)
I don't know why using a different host name changes the result but the application is quite simple.
Reports.aspx
<%@ Page Title="Title" Language="C#" MasterPageFile="~/Site.Master" CodeBehind="Reports.aspx.cs" Inherits="ReportingPortal.WebForms.Reports" %>
<%@ Register TagPrefix="rsweb" Namespace="Microsoft.Reporting.WebForms" Assembly="Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<rsweb:ReportViewer Width="100%" ID="ReportViewer" runat="server" ProcessingMode="Remote">
<ServerReport></ServerReport>
</rsweb:ReportViewer>
</asp:Content>
Reports.aspx.cs
using System;
using System.Configuration;
using System.Web.UI;
namespace ReportingPortal.WebForms
{
public partial class Reports : Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
ReportViewer.ServerReport.ReportServerCredentials = new ReportServerCredentials();
ReportViewer.ServerReport.ReportPath = "/example/report/path";
ReportViewer.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings.Get("ReportServerUrl"));
}
}
}
Does anyone know why this is happening?