46 lines
1.4 KiB
VB.net
46 lines
1.4 KiB
VB.net
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()
|
|
Catch ex As Exception
|
|
'GuardaLog($"GenerateFile: {ex.ToString()}")
|
|
End Try
|
|
End Sub
|
|
|
|
|
|
End Class
|