-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pruebas3.aspx.vb
35 lines (31 loc) · 1.43 KB
/
Pruebas3.aspx.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Imports Modulo
Imports System.Xml
Imports System.Data
Partial Class Pruebas3
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
End Sub
Protected Sub BtnDescarga_Click(sender As Object, e As EventArgs) Handles BtnDescargar.Click
Try
Dim DocNum As String = "320308"
Dim DocDate As String = "17-01-18"
Dim FolioPdf As String = "Primario_" & DocNum & "_" & DocDate & "_" & Session("RfcCliente") & ".pdf"
'Limpiamos la salida
Response.Clear()
'Con esto le decimos al browser que la salida sera descargable
Response.ContentType = "application/octet-stream"
'esta linea es opcional, en donde podemos cambiar el nombre del fichero a descargar (para que sea diferente al original)
Response.AddHeader("Content-Disposition", "attachment; filename=" & FolioPdf)
' Escribimos el fichero a enviar
'Response.WriteFile("~/PDF/" & FolioPdf)
Response.WriteFile("C:/Forsedi/Archivos/PDF/" & FolioPdf)
' volcamos el stream
Response.Flush()
'Enviamos todo el encabezado ahora
Response.End()
Catch ex As Exception
Dim fail As String = ex.Message
ClientScript.RegisterStartupScript(Me.[GetType](), "aleasrt", "alert('" & fail & "'); ", True)
End Try
End Sub
End Class