//The DeviceInfo settings should be changed based on the reportType //http://msdn2.microsoft.com/en-us/library/ms155397.aspx string deviceInfo = "<DeviceInfo>" + "</DeviceInfo>";
//Render the report renderedBytes = ReportViewer.LocalReport.Render( reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
//Clear the response stream and write the bytes to the outputstream //Set content-disposition to "attachment" so that user is prompted to take an action //on the file (open or save) Response.Clear(); Response.ContentType = mimeType; Response.AddHeader("content-disposition", "attachment; filename=foo." + fileNameExtension); Response.BinaryWrite(renderedBytes); Response.End();
I don't know if it is the best solution, but it works for my requirement.
Marked as answer byPhipu1Thursday, October 28, 2010 6:42 AM