Creating a pdf file using asp.net C# 2003 and to get a prompt window / Crystal Report
I have this click button event in an asp.net page.
Note I am using asp.net 2003 1.1 framework. I want to be able
to generate a pdf file. It is working very well and once I click
on the button the document is opened in pdf format.
I want to be able to get a prompt that will ask me if I want to open
it or save as pdf. how can I acheive that please.
Something like this below in form of a small window
"Do you want to open or save this file
open save cancel"
private void Button2_Click(object sender, System.EventArgs e) { // Get the report document ReportDocument repDoc = getReportDocument(); // Stop buffering the response Response.Buffer = false; // Clear the response content and headers Response.ClearContent(); Response.ClearHeaders(); try { // Export the Report to Response stream in PDF format and file name Customers MemoryStream oStream; // using System.IO oStream = (MemoryStream) repDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); Response.Clear(); Response.Buffer= true; Response.ContentType = "application/pdf"; Response.BinaryWrite(oStream.ToArray()); Response.End(); } catch(Exception ex) { Console.WriteLine(ex.Message); ex = null; } }