Render PDF File onto Client's Browser
Generic Procedure for Rendering given file to Client's Browser : protected void WriteToResponse( string fileName, bool saveAsFile, string fileFormat, System.IO. MemoryStream stream) { if (Page == null Page.Response == null ) return ; string disposition = saveAsFile ? "attachment" : "inline" ; Page.Response.Clear(); Page.Response.Buffer = false ; Page.Response.AppendHeader( "Content-Type" , string .Format( "application/{0}" , fileFormat)); Page.Response.AppendHeader( "Content-Transfer-Encoding" , "binary" ); Page.Response.AppendHeader( "Content-Disposition" , string .Format( "{0}; filename={1}.{2}" , disposition, fileName, fileFormat)); Page.Response.BinaryWrite(stream.GetBuffer()); Page.Response.End(); } //Saves File on Server - For given Location