R
REB
This weekend I had to migrate a application from a windows 2000 server to a
windows 2003 server. Everything seems to be working except a button
contained on a page with a crystal report that is suppose to convert a
crystal report to pdf and stream it back to the users browser. It still
works in my development environment and on the windows 2000 server, but not
on window 2003 standard server.
Is there a setting in IIS 6.0 that I need to change to allow memory
streaming?
Here is the code first for the button and the function is calls:
private void Button1_Click(object sender, System.EventArgs e)
{
ConvertToPDF();
}
private void ConvertToPDF()
{
sqlSelectCommand1.CommandText = @"SELECT dbo.Bond.prin_name,
dbo.Bond.Issued_Bond_Num, dbo.Bond.type, dbo.Obligee.name,
dbo.Bond.bond_description, dbo.Bond.bond_amount, dbo.Bond.premium,
dbo.Bond.eff_date, dbo.Bond.expir_date, dbo.Obligee.state FROM dbo.Bond
INNER JOIN dbo.Obligee ON dbo.Bond.obligee_num = dbo.Obligee.obligee_num
WHERE (dbo.Obligee.state = '"+ TextBox1.Text +"') AND (dbo.Bond.status_bond
<= 2) Order by " + ddlSort.SelectedValue;
daBondState.Fill(dsBondState1);
BondState oRpt = new BondState();
oRpt.SetDataSource(dsBondState1);
System.IO.MemoryStream mystream = new System.IO.MemoryStream();
try
{
mystream =
(System.IO.MemoryStream)oRpt.ExportToStream(ExportFormatType.PortableDocForm
at);
}
catch(Exception ex)
{
Response.Write("There was an error exporting the report to PDF. Details:" +
ex);
}
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.ContentType = "application/pdf";
HttpContext.Current.Response.AddHeader("Content-Disposition", "inline;
filename=BondbyUnitNum.pdf");
HttpContext.Current.Response.BinaryWrite(mystream.ToArray());
HttpContext.Current.Response.End();
}
windows 2003 server. Everything seems to be working except a button
contained on a page with a crystal report that is suppose to convert a
crystal report to pdf and stream it back to the users browser. It still
works in my development environment and on the windows 2000 server, but not
on window 2003 standard server.
Is there a setting in IIS 6.0 that I need to change to allow memory
streaming?
Here is the code first for the button and the function is calls:
private void Button1_Click(object sender, System.EventArgs e)
{
ConvertToPDF();
}
private void ConvertToPDF()
{
sqlSelectCommand1.CommandText = @"SELECT dbo.Bond.prin_name,
dbo.Bond.Issued_Bond_Num, dbo.Bond.type, dbo.Obligee.name,
dbo.Bond.bond_description, dbo.Bond.bond_amount, dbo.Bond.premium,
dbo.Bond.eff_date, dbo.Bond.expir_date, dbo.Obligee.state FROM dbo.Bond
INNER JOIN dbo.Obligee ON dbo.Bond.obligee_num = dbo.Obligee.obligee_num
WHERE (dbo.Obligee.state = '"+ TextBox1.Text +"') AND (dbo.Bond.status_bond
<= 2) Order by " + ddlSort.SelectedValue;
daBondState.Fill(dsBondState1);
BondState oRpt = new BondState();
oRpt.SetDataSource(dsBondState1);
System.IO.MemoryStream mystream = new System.IO.MemoryStream();
try
{
mystream =
(System.IO.MemoryStream)oRpt.ExportToStream(ExportFormatType.PortableDocForm
at);
}
catch(Exception ex)
{
Response.Write("There was an error exporting the report to PDF. Details:" +
ex);
}
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.ContentType = "application/pdf";
HttpContext.Current.Response.AddHeader("Content-Disposition", "inline;
filename=BondbyUnitNum.pdf");
HttpContext.Current.Response.BinaryWrite(mystream.ToArray());
HttpContext.Current.Response.End();
}