Option Strict On Option Explicit On Imports Extensiones Partial Class PopUpImprimir Inherits ClsPaginas Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then If Request("RH") IsNot Nothing Then Dim Ext As String = Request("Ext") Dim ArchivoPath As String = String.Format("{0}Empresas\{1}\Temp\{2}{3}", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Ext) If ArchivoPath <> "" Then Dim Archivo As New System.IO.FileInfo(ArchivoPath) If Archivo.Exists Then HttpContext.Current.Response.Clear() HttpContext.Current.Response.ClearContent() 'HttpContext.Current.Response.ContentType = "application/msword" HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document" HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" & Archivo.Name) HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString()) HttpContext.Current.Response.TransmitFile(ArchivoPath) HttpContext.Current.Response.Flush() HttpContext.Current.Response.End() End If Archivo = Nothing End If ElseIf Request("Tipo") IsNot Nothing AndAlso Request("Tipo") = "AcuseCancelacion" Then Dim Ext As String = Request("Ext") Dim Path As String = AppDomain.CurrentDomain.BaseDirectory & "Temp\" & Request("FolioFiscal") & "." & Ext Dim Archivo As New System.IO.FileInfo(Path) If Archivo.Exists Then HttpContext.Current.Response.Clear() HttpContext.Current.Response.ClearContent() HttpContext.Current.Response.ContentType = "application/pdf" HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" & Archivo.Name) HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString()) HttpContext.Current.Response.TransmitFile(Path) 'HttpContext.Current.Response.Flush() HttpContext.Current.Response.End() End If Archivo = Nothing Else Dim CveVenta As String = Request("CveVenta") Dim Ext As String = Request("Ext") If Ext = "CadenaOriginal" Then Dim ObjVentas As New ClsVentas() If ObjVentas.GetCadenaOriginal(CveVenta.ToEntero) Then If ObjVentas.DtResultados.Rows.Count >= 0 Then Response.Write(ObjVentas.DtResultados.Rows(0)(0).ToString) End If ObjVentas.Dispose() CType(Me.Master, BaseMasterPage).EsPopup = True CType(Me.Master, BaseMasterPage).PopupWidth = 800 RegistraScript("$get('tdContenido').style.height='520px'") Else Dim Path As String = UsuarioActual.Empresa.Ruta & Ext & "\" & CveVenta & "." & Ext Dim Archivo As New System.IO.FileInfo(Path) If Archivo.Exists Then HttpContext.Current.Response.Clear() HttpContext.Current.Response.ClearContent() HttpContext.Current.Response.ContentType = "application/pdf" HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" & Archivo.Name) HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString()) HttpContext.Current.Response.TransmitFile(Path) 'HttpContext.Current.Response.Flush() HttpContext.Current.Response.End() End If Archivo = Nothing End If End If End If End Sub End Class