public void Page_Load(object sender, System.EventArgs e) { try { Response.Expires = -1; if (!IsPostBack && !this.AlreadyDownloaded) { // string id = Session.SessionID; // DocsPaWR.FileDocumento theDoc = FileManager.getInstance(id).getReport(this); // Response.ContentType = theDoc.contentType; // Response.ContentType = "application/octet-stream"; // Response.AddHeader("content-disposition", "attachment;filename=" + theDoc.name); // Response.AddHeader("content-lenght", theDoc.content.Length.ToString()); // Response.BinaryWrite(theDoc.content); DocsPaWR.FileDocumento file = new DocsPaWR.FileDocumento(); exportDatiSessionManager sessioneManager = new exportDatiSessionManager(); file = sessioneManager.GetSessionExportFile(); sessioneManager.ReleaseSessionExportFile(); if (file != null && file.content.Length > 0) { Response.ContentType = file.contentType; Response.AddHeader("content-disposition", "inline;filename=" + file.fullName); Response.AddHeader("content-lenght", file.content.Length.ToString()); if (this.IsApplet || this.IsSocket) { string base64String = System.Convert.ToBase64String(file.content, 0, file.content.Length); Response.Write(base64String); } else { Response.BinaryWrite(file.content); Response.Flush(); //Response.Close(); //Response.End(); } } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "parent.ajaxDialogModal('ErrorExportDati', 'warning', '');", true); } this.AlreadyDownloaded = true; } } catch (System.Exception ex) { UIManager.AdministrationManager.DiagnosticError(ex); return; } }
protected void Page_Load(object sender, EventArgs e) { try { DocsPaWR.FileDocumento file = new DocsPaWR.FileDocumento(); exportDatiSessionManager sessioneManager = new exportDatiSessionManager(); file = sessioneManager.GetSessionExportFile(); sessioneManager.ReleaseSessionExportFile(); if (file != null && file.content.Length > 0) { Response.ContentType = file.contentType; Response.AddHeader("content-disposition", "inline;filename=" + file.fullName); Response.AddHeader("content-lenght", file.content.Length.ToString()); if (this.IsApplet) { string base64String = System.Convert.ToBase64String(file.content, 0, file.content.Length); Response.Write(base64String); } else { Response.BinaryWrite(file.content); Response.Flush(); } } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "parent.ajaxDialogModal('ErrorExportDati', 'warning', '');", true); } } catch { ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "parent.ajaxDialogModal('ErrorExportDati', 'warning', '');", true); } }
protected void Page_Load(object sender, EventArgs e) { try { componentType = UserManager.getComponentType(Request.UserAgent); this.InitApplet(); this.InitLanguage(); string tipologia = "rtf"; Response.Expires = -1; if (!IsPostBack && !this.AlreadyDownloaded) { DocsPaWR.FileDocumento file = new DocsPaWR.FileDocumento(); exportDatiSessionManager sessioneManager = new exportDatiSessionManager(); file = sessioneManager.GetSessionExportFile(); if (file == null || file.content == null || file.content.Length == 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "ajaxDialogModal('InfoExportDatiNoneFound', 'info', '');", true); if (componentType == Constans.TYPE_APPLET) { ScriptManager.RegisterStartupScript(this, this.GetType(), "openFile", "OpenFileApplet('" + tipologia + "');", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "openFile", "OpenFileActiveX('" + tipologia + "');", true); } } else { if (!string.IsNullOrEmpty(file.name) && FileManager.getEstensioneIntoP7M(file.name).ToUpper().Equals("PDF")) { tipologia = "PDF"; } String script = "OpenFileApplet('" + tipologia + "');"; switch (componentType) { case Constans.TYPE_ACTIVEX: case Constans.TYPE_SMARTCLIENT: script = "OpenFileActiveX('" + tipologia + "');"; break; case Constans.TYPE_SOCKET: script = "OpenFileSocket('" + tipologia + "');"; break; default: script = "OpenFileApplet('" + tipologia + "');"; break; } ScriptManager.RegisterStartupScript(this, this.GetType(), "openFile", script, true); } } } catch (System.Exception ex) { UIManager.AdministrationManager.DiagnosticError(ex); return; } }