Aca te adjunto el code behind.
Protected Sub btnDesc6101_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDesc610.Click
Try
'If (PortalSecurity.IsInRole("Unauthenticated Users")) Or (PortalSecurity.IsInRole("Administrators")) Or (PortalSecurity.IsInRole("Registered Users")) Then
'MsgBox("ENTRO")
Response.Clear()
Response.ClearHeaders()
Dim fs As IO.FileStream = Nothing
Dim path As String = "C:\inetpub\wwwroot\corpocesar\documentos\NormatividadReal\res_0610_240310.pdf"
'obtenemos el archivo del servidor
fs = IO.File.Open(path, IO.FileMode.Open, IO.FileAccess.Read)
Dim byteBuffer(CInt(fs.Length - 1)) As Byte
fs.Read(byteBuffer, 0, CInt(fs.Length))
fs.Close()
Using ms As New IO.MemoryStream(byteBuffer)
'descargar con su nombre original
Response.AddHeader("Content-Disposition", "attachment; filename=resolucion_610_2010.pdf")
ms.WriteTo(Response.OutputStream)
End Using
Response.End()
'End If
Catch ex As Exception
ProcessModuleLoadException(Me, ex)
End Try
End Sub
Protected Sub btnDesc651_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDesc651.Click
If PortalSecurity.IsInRole("Unauthenticated Users") Or (PortalSecurity.IsInRole("Administrators")) Or (PortalSecurity.IsInRole("Registered Users")) Then
Dim fs As IO.FileStream = Nothing
Dim path As String = "C:\inetpub\wwwroot\corpocesar\documentos\NormatividadReal\res_0651_290310_SISAIRE.PDF"
'obtenemos el archivo del servidor
fs = IO.File.Open(path, IO.FileMode.Open, IO.FileAccess.Read)
Dim byteBuffer(CInt(fs.Length - 1)) As Byte
fs.Read(byteBuffer, 0, CInt(fs.Length))
fs.Close()
Using ms As New IO.MemoryStream(byteBuffer)
'descargar con su nombre original
Response.AddHeader("Content-Disposition", "attachment; filename=resolucion_651_2010.pdf")
ms.WriteTo(Response.OutputStream)
End Using
End If
End Sub
Protected Sub btnDescManOp_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDescManOp.Click
If PortalSecurity.IsInRole("Unauthenticated Users") Or (PortalSecurity.IsInRole("Administrators")) Or (PortalSecurity.IsInRole("Registered Users")) Then
Dim fs As IO.FileStream = Nothing
Dim path As String = "C:\inetpub\wwwroot\corpocesar\documentos\NormatividadReal\res_2154_021110_manual_operacio.pdf"
'obtenemos el archivo del servidor
fs = IO.File.Open(path, IO.FileMode.Open, IO.FileAccess.Read)
Dim byteBuffer(CInt(fs.Length - 1)) As Byte
fs.Read(byteBuffer, 0, CInt(fs.Length))
fs.Close()
Using ms As New IO.MemoryStream(byteBuffer)
'descargar con su nombre original
Response.AddHeader("Content-Disposition", "attachment; filename=resolucion_2154_ManOpe_2010.pdf")
ms.WriteTo(Response.OutputStream)
End Using
End If
End Sub
Protected Sub btnDescManDis_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDescManDis.Click
If PortalSecurity.IsInRole("Unauthenticated Users") Or (PortalSecurity.IsInRole("Administrators")) Or (PortalSecurity.IsInRole("Registered Users")) Then
Dim fs As IO.FileStream = Nothing
Dim path As String = "C:\inetpub\wwwroot\corpocesar\documentos\NormatividadReal\res_2154_021110_manual_diseno.pdf"
'obtenemos el archivo del servidor
fs = IO.File.Open(path, IO.FileMode.Open, IO.FileAccess.Read)
Dim byteBuffer(CInt(fs.Length - 1)) As Byte
fs.Read(byteBuffer, 0, CInt(fs.Length))
fs.Close()
Using ms As New IO.MemoryStream(byteBuffer)
'descargar con su nombre original
Response.AddHeader("Content-Disposition", "attachment; filename=resolucion_2154_ManDis_2010.pdf")
ms.WriteTo(Response.OutputStream)
End Using
End If
End Sub
Protected Sub btnDesc2154_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDesc2154.Click
If PortalSecurity.IsInRole("Unauthenticated Users") Or (PortalSecurity.IsInRole("Administrators")) Or (PortalSecurity.IsInRole("Registered Users")) Then
Dim fs As IO.FileStream = Nothing
Dim path As String = "C:\inetpub\wwwroot\corpocesar\documentos\NormatividadReal\res_2154_de_2010_ajuste del protocolo.PDF"
'obtenemos el archivo del servidor
fs = IO.File.Open(path, IO.FileMode.Open, IO.FileAccess.Read)
Dim byteBuffer(CInt(fs.Length - 1)) As Byte
fs.Read(byteBuffer, 0, CInt(fs.Length))
fs.Close()
Using ms As New IO.MemoryStream(byteBuffer)
'descargar con su nombre original
Response.AddHeader("Content-Disposition", "attachment; filename=resolucion_2154_2010.pdf")
ms.WriteTo(Response.OutputStream)
End Using
End If
End Sub
Protected Sub btnDesc1732_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDesc1732.Click
If PortalSecurity.IsInRole("Unauthenticated Users") Or (PortalSecurity.IsInRole("Administrators")) Or (PortalSecurity.IsInRole("Registered Users")) Then
Dim fs As IO.FileStream = Nothing
Dim path As String = "C:\inetpub\wwwroot\corpocesar\documentos\NormatividadReal\Res1732de2010_Area_Fuente.pdf"
'obtenemos el archivo del servidor
fs = IO.File.Open(path, IO.FileMode.Open, IO.FileAccess.Read)
Dim byteBuffer(CInt(fs.Length - 1)) As Byte
fs.Read(byteBuffer, 0, CInt(fs.Length))
fs.Close()
Using ms As New IO.MemoryStream(byteBuffer)
'descargar con su nombre original
Response.AddHeader("Content-Disposition", "attachment; filename=resolucion_1732_2010.pdf")
ms.WriteTo(Response.OutputStream)
End Using
End If
End Sub
En este logro la descarga de cada uno d elos botones el el page load no puse nada, por esta razon no subo nada de eso.
Espero que me puedas ayudar pruebalo y me dices si te corre a ti.
Gracias por tu colaboracion