-- condiconal para descarga de OI, Para E13,83

This commit is contained in:
2023-07-15 10:44:36 -07:00
parent 75a628acd4
commit 06e41a255a
2 changed files with 74 additions and 19 deletions

View File

@@ -1,32 +1,45 @@

Partial Class Metronic_SigAyuda
Inherits System.Web.UI.Page
Option Explicit On
Option Strict On
Imports Extensiones
Partial Class Metronic_SigAyuda
Inherits ClsPaginas
Private Sub Metronic_SigAyuda_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
If usuarioActual.CveEmpresa.Contiene(13, 83) Then
divtaskOI.Visible = True
End If
End If
End Sub
Protected Sub btnDownload_Click(sender As Object, e As EventArgs)
Try
Dim docto As String = TxtDocto.Text.Replace("/", "\")
Dim path As String = $"{AppDomain.CurrentDomain.BaseDirectory}{docto}"
Dim file As New System.IO.FileInfo(path)
Dim mimeType As String = "text/plain"
Try
mimeType = MimeMapping.GetMimeMapping(path)
Catch ex As Exception
End Try
'Response.Write(path)
Response.Clear()
Response.ClearHeaders()
Response.ClearContent()
Response.AddHeader("Content-Disposition", $"attachment; filename= {Uri.EscapeDataString(file.Name)}")
Response.AddHeader("Content-Length", file.Length.ToString())
Response.ContentType = mimeType
Response.Flush()
Response.TransmitFile(file.FullName)
Response.End()
Dim mimeType As String = "text/plain"
Try
mimeType = MimeMapping.GetMimeMapping(path)
Catch ex As Exception
End Try
'Response.Write(path)
Response.Clear()
Response.ClearHeaders()
Response.ClearContent()
Response.AddHeader("Content-Disposition", $"attachment; filename= {Uri.EscapeDataString(file.Name)}")
Response.AddHeader("Content-Length", file.Length.ToString())
Response.ContentType = mimeType
Response.Flush()
Response.TransmitFile(file.FullName)
Response.End()
Catch ex As Exception
'GuardaLog($"GenerateFile: {ex.ToString()}")
End Try
End Sub
End Class