Ludek,
I think VS2008 was used to create the ASP.NET application. The website was reconfigured for .NET 4.0 framework. Since the application consist of only 14 page containing mostly HTML markup, it runs without issue. I've updated the web.config file as per CR2008 SP6 documentation.
The code-behind that launches the CR2008 report is:
protected void Page_Load(object sender, EventArgs e)
{
string server = ConfigurationManager.AppSettings["EBusinessServerName"];
string userid = ConfigurationManager.AppSettings["EBusinessUserId"];
string password = ConfigurationManager.AppSettings["EBusinessPassword"];
if (IsPostBack == false)
SetSessionVariables();
ConfigureCrystalReports();
Toolkit.LogonToDataServer(CrystalReportViewer1, server, userid, password);
CrystalReportViewer1.HasToggleGroupTreeButton = false;
CrystalReportViewer1.HasToggleParameterPanelButton = false;
CrystalReportViewer1.HasCrystalLogo = false;
}
The ConfigureCrystalReports() method (too long to post) uses a number of IF statements to set the following properties on the CrystalReportViewer1 object: ReportSource, ParameterFieldInfo, SelectionFormula.
Toolkit class contains the following:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
/// <summary>
/// Common application methods.
/// </summary>
public class Toolkit
{
/// <summary>
/// Log on to data server
/// Refer to Windows "Data Sources (ODBC)" administration tool.
/// </summary>
/// <param name="crViewer">crystal report viewer object</param>
/// <param name="server">server name</param>
/// <param name="userid">user's id</param>
/// <param name="password">user's password</param>
static public void LogonToDataServer(CrystalDecisions.Web.CrystalReportViewer crViewer,
string server, string userid, string password)
{
if (server == null)
server = ConfigurationManager.AppSettings["EBusinessServerName"];
if (userid == null)
userid = ConfigurationManager.AppSettings["EBusinessUserId"];
if (password == null)
password = ConfigurationManager.AppSettings["EBusinessPassword"];
// set crystal report logon information.
ConnectionInfo ci = new ConnectionInfo();
ci.ServerName = server;
ci.UserID = userid;
ci.Password = password;
// add logon information to logon information table.
TableLogOnInfo logon = new TableLogOnInfo();
logon.ConnectionInfo = ci;
TableLogOnInfos logons = new TableLogOnInfos();
logons.Add(logon);
// try to log into crystal reports viewer.
crViewer.LogOnInfo = logons;
}
/// <summary>
/// Get report file name based on report code.
/// </summary>
/// <param name="code">report code from default.aspx page.</param>
/// <returns>the report file name</returns>
static public string GetReportPath(string code)
{
string path = ConfigurationManager.AppSettings[code];
return (path == null ? "" : path);
}
/// <summary>
/// Convert report file name to a report title name.
/// </summary>
/// <param name="code">report code from default.aspx page.</param>
/// <returns>the report name</returns>
static public string GetReportName(string code)
{
string report = GetReportPath(code);
return System.IO.Path.GetFileName(report).Replace(".rpt", " Report");
}
}
I hope this provides more clarity. Thanks, Gary.