ya se pueden subir y descar los certificados

This commit is contained in:
Antonio Gonzalez
2020-07-02 14:18:09 -07:00
parent 2dc93d59cf
commit 8859496163
2 changed files with 103 additions and 85 deletions

View File

@@ -5,6 +5,7 @@ Imports System.Data
Imports Extensiones
Imports System.Runtime.InteropServices
Imports System.IO
Imports Microsoft.Reporting.WebForms
Partial Class Sistemas_Empresa
Inherits ClsPaginas
@@ -404,7 +405,7 @@ Partial Class Sistemas_Empresa
LbBannerDescarga.OnClientClick = "javascript:AbrirVentana('/Cer/" & .ArchivoCer & "', 500, 500, 'N', 'ArchivoCer Empresa');"
Session("FileUpload") = .ArchivoCer
LbArchivoPfxDescarga.OnClientClick = "javascript:AbrirVentana('/Pfx/" & .ArchivoPfx & "', 500, 500, 'N', 'ArchivoPfx Empresa');"
'LbArchivoPfxDescarga.OnClientClick = "javascript:AbrirVentana('/Pfx/" & .ArchivoPfx & "', 500, 500, 'N', 'ArchivoPfx Empresa');"
Session("FileUpload") = .ArchivoPfx
End With
@@ -1680,26 +1681,39 @@ Partial Class Sistemas_Empresa
Catch ex As Exception
TieneError = True
End Try
Next
If Not TieneError Then
Next
If Not TieneError Then
Alert("Certificado cargado con exito")
RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalArchvivo"))
End If
TxtCargaImg.getfiles().Archivos = Nothing
UpAddArchivo.Update()
End Sub
Protected Sub LbArchivoKeyDescarga_Download(sender As Object, e As EventArgs) Handles LbArchivoKeyDescarga.Click
Dim NombreArchivo As String = TxtArchivoKey.Text
DescargarArchivo(NombreArchivo)
End Sub
Protected Sub LbArchivoCerDescarga_Download(sender As Object, e As EventArgs) Handles LbArchivoCerDescarga.Click
Dim NombreArchivo As String = TxtArchivoCer.Text
DescargarArchivo(NombreArchivo)
End Sub
Protected Sub LbArchivoPfxDescarga_Download(sender As Object, e As EventArgs) Handles LbArchivoPfxDescarga.Click
End If
TxtCargaImg.getfiles().Archivos = Nothing
UpAddArchivo.Update()
End Sub
Protected Sub LbArchivoKeyDescarga_Download(sender As Object, e As EventArgs) Handles LbArchivoKeyDescarga.Click
Dim FilePath As String = String.Format("{0}Empresas\{1}\Certificados\{2}", ModExtensiones.DirectorioBaseEmpresas, CveEmpresa, TxtArchivoKey.Text)
'Dim fi As New FileInfo(File)
Dim byteArray As Byte() = File.ReadAllBytes(FilePath)
'HttpContext.Current.Response.Clear()
'HttpContext.Current.Response.ClearContent()
'HttpContext.Current.Response.ContentType = "application/octet-stream"
'HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment filename=prueba.docx")
'HttpContext.Current.Response.AddHeader("Content-Length", byteArray.Length.ToString())
Dim NombreArchivo As String = TxtArchivoPfx.Text
DescargarArchivo(NombreArchivo)
End Sub
Private Sub DescargarArchivo(NombreArchivo As String)
Dim FilePath As String = String.Format("{0}Empresas\{1}\Certificados\{2}", ModExtensiones.DirectorioBaseEmpresas, CveEmpresa, NombreArchivo)
Dim byteArray As Byte() = File.ReadAllBytes(FilePath)
HttpContext.Current.Response.Clear()