ServerReport.ReportServerCredentials Issues
Mar 14, 2007
hi all,
I am trying using network credentials in
Myreportviewer.ServerReport.ReportServerCredentials, and let users access the reports on the report server no matter whether the asp app and report server are on the same server. I set up the username, password and domain for the network credentials, and set it to the reportServerCredentials. but when the app running, throught the reportviewer, the report can be access, but no data can be got from datasource(some parameters comes from queries on datasource, and they are unavaible and greyed). if I don't set the reportservercredentials but use <indentidy impersonate = true> and use the windows authentication(disable the anonymouse access) in the iis, it works well, but it works only when aasp app and reportserver are on the same server.
MyReportViewer.ServerReport.ReportServerCredentials =
new MyReportServerCredentials();
Does somebody have any idea?
Thanks a lot,
Jone
View 3 Replies
May 21, 2008
I have a report that includes two required parameters where the values are defined to be 'from query' and where the set of values displayed/allowed for the second parameter/drop-down are dependent on the selection from the first parameter/drop-down.
While this works fine in Visual Studio and via the ReportManager web interface, when I attempt to use the Windows Forms ReportViewer control and supply the parameter values via the ReportViewer.ServerReport.SetParameters() call the report does not accept the input values and indicates that no value has been supplied for the first parameter even though it was. Note that I am calling SetParameters() in code and not using the viewer control's parameter prompts (because they are ugly and allow for no validation beyond required/not-required).
I have tried a number of work-arounds but it seems that the only option is to change the implementation of the report so that the 'from query' parameters are no longer 'from query' but instead just simple input fields.
This allows the ReportViewer control and associated code to work, but since the input values I need are actually GUID values this is obviously less than ideal for running the report from Visual Studio or the web interface.
Am I missing something or is this some kind of a limitation/bug in the viewer control?
Thanks in advance -- /chris
View 3 Replies
View Related
Jun 20, 2007
I'm new to programming with the ReportViewer object and this issue has me stumped: it appears if you have some optional parameters in your report, and a way to refresh that report with different parameter values, the report "remembers" parameter values from previous calls to SetParameters() on subsequent renderings of the report. If a parameter is included in a call to ServerReport.SetParameters() on the first rendering, but not included in a subsequent call and the report is re-rendered, the previous value of the parameter (rather than the default value) appears to be used.
Here's a snippet of some test code I wrote within an ASP.NET 2.0 test application:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.rptViewer.ServerReport.ReportServerUrl = new Uri(this.txtReportServerUrl.Text);
this.rptViewer.ServerReport.ReportPath = this.txtReportPath.Text;
}
}
protected void btnViewRpt_Click(object sender, EventArgs e)
{
ReportParameter[] rptParams = GetReportParameters();
this.rptViewer.ServerReport.SetParameters(rptParams);
this.rptViewer.ServerReport.Refresh();
}
private ReportParameter[] GetReportParameters()
{
int paramCount = 0;
ReportParameter[] retVal;
string emptyVal = null;
if (txtName.Text != "") paramCount++;
if (txtAddress.Text != "") paramCount++;
if (txtZip.Text != "") paramCount++;
retVal = new ReportParameter[paramCount];
paramCount = 0;
if (txtName.Text != "")
retVal[paramCount++] = new ReportParameter("Name", txtName.Text);
if (txtAddress.Text != "")
retVal[paramCount++] = new ReportParameter("Address", txtAddress.Text);
if (txtZip.Text != "")
retVal[paramCount++] = new ReportParameter("Zip", txtZip.Text);
return retVal;
}
The test report was written to simply echo back the values of the parameters that are specified. The report definition allows NULL to be specified for the parameters.
The test app was written so if I enter a blank value for Name, Address or Zip, the corresponding parameter does not get created in C# and does not get sent to the report server. If I view the report with all three values (parameters) filled in, I see the parameters echoed back to me in my simple report as expected. If I clear the parameter values the first time the report is rendered, none are sent to the report server and I get no values echoed back in my report, also as expected. I can change the values and click on the View Report button and see the new values for the parameters as expected. However, if I clear any previously-specified parameters and click on View Report, the previously-specified values for the ones that are now cleared are still displayed by the report.
So my question is: once a parameter has been sent to the report, how does one "unsend" it on subsequent refreshes? I know I can create the parameter and set its value to null...but I have a situation here where that can cause errors. It'd be better if I could simply leave out the unspecified parameters and have the report refresh and render as if I were rendering it for the first time.
Any suggestions?
View 7 Replies
View Related