`So I had to change the way an ASP.NET 2.0 application called reports from pages. Originally, I used JavaScript to open a new window.
ViewCostReport.OnClientClick = "window.open('" + Report.GetProjectCostURL(_PromotionID) + "','ProjectCost','resizable=yes')";
The issue I had was that the window.open call would only work within the client network and not on a new web server located in their DMZ. I had to create a new report WebForm that embedded a ReportViewer control to view the reports.
The other issue I had is that the Report Server had to be accessed with windows Authentication since it was being used by another application for reports and that app used roles for report access. So off I went to get my ReportViewer control to impersonate a windows user. I found the solution to be this:
Create a new class which implements the Microsoft.Reporting.WebForms.IReportServerCredentials interface for accessing the reports.
public class ReportCredentials : Microsoft.Reporting.WebForms.IReportServerCredentials
{
string _userName, _password, _domain;
public ReportCredentials(string userName, string password, string domain)
{
_userName = userName;
_password = password;
_domain = domain;
}
public System.Security.Principal.WindowsIdentity ImpersonationUser
{
get
{
return null;
}
}
public System.Net.ICredentials NetworkCredentials
{
get
{
return new System.Net.NetworkCredential(_userName, _password, _domain);
}
}
public bool GetFormsCredentials(out System.Net.Cookie authCoki, out string userName, out string password, out string authority)
{
userName = _userName;
password = _password;
authority = _domain;
authCoki = new System.Net.Cookie(".ASPXAUTH", ".ASPXAUTH", "/", "Domain");
return true;
}
}
Then I created an event for the button to call the report:
protected void btnReport_Click(object sender, EventArgs e)
{
ReportParameter[] parm = new ReportParameter[1];
parm[0] =new ReportParameter("PromotionID",_PromotionID);
ReportViewer.ShowCredentialPrompts = false;
ReportViewer.ServerReport.ReportServerCredentials = new ReportCredentials("Username", "Password", "Domain");
ReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
ReportViewer.ServerReport.ReportServerUrl = new System.Uri("http://ReportServer/ReportServer");
ReportViewer.ServerReport.ReportPath = "/ReportFolder/ReportName";
ReportViewer.ServerReport.SetParameters(parm);
ReportViewer.ServerReport.Refresh();
}
Best Answer
Cause
The ReportViewer control renders charts as a PNG image. The ReportViewer adds
width
,height
, andmin-width
properties to the CSS for the image. These CSS properties cause the image to undergo scaling to a slightly smaller size in the browser. The image scaling causes the observed blurriness.Resolution
The issue is resolved in our environment by using additional CSS to override several CSS properties rendered by the ReportViewer. The Reporting Services chart is given a special tag in BIDS so a CSS selector can find the affected image.
Step 1. Give the chart a unique value for its
ToolTip
property:(The unique value in this example is MyOfficeChart.)
When the chart is rendered as an
<img>
, the<img>
tag'salt
andtitle
attributes are set to this value.Step 2. Create CSS to select the
<img>
by the unique value of thetitle
attribute, and override the issue-causing CSS:These steps resolve the issue for all browsers and users, and whether the chart has a border or not.