public void ProcessRequest(HttpContext context)
{
ReportDocument rd = new ReportDocument();
try
{
string path = context.Server.MapPath(ResolveUrl(GetReportPath()));
rd.Load(path);
if (GetIsODBC() == true)
{
string user = System.Configuration.ConfigurationManager.AppSettings["ReportUserName"];
string password = System.Configuration.ConfigurationManager.AppSettings["ReportUserPassword"];
rd.SetDatabaseLogon(user, password);
}
this.SetReportDataSources(context, rd); //set the data sources
context.Response.Clear();
rd.ExportToHttpResponse(ExportFormatType.PortableDocFormat, context.Response, false, string.Empty);
context.Response.ContentType = "application/pdf";
context.Response.Flush();
context.Response.Close();
}
catch (Exception e)
{
context.Response.Clear();
context.Response.Write(e.ToString());
context.Response.Flush();
context.Response.Close();
}
finally
{
rd.Close();
}
}
|