Ver Mensaje Individual
  #2 (permalink)  
Antiguo 03/11/2008, 15:42
vicman029
 
Fecha de Ingreso: octubre-2008
Mensajes: 26
Antigüedad: 15 años, 6 meses
Puntos: 0
Respuesta: pagina de descargas en asp.net con vb 2005

weno ya que nadie me responde yo mismo me respondere despues de mucho investigar...

1. crear referencia en cualquier pagina al archivo
<a href="download.aspx?file=Data/formato.xls">Formato Excel</a>

2. crear una págiina download.aspx con los siguientes datos

<%@ Page language="vb" runat="server" explicit="true" strict="true" %>
<script language="vb" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Dim strRequest As String = Request.QueryString("file")
'-- if something was passed to the file querystring
If strRequest <> "" Then
'get absolute path of the file
Dim path As String = Server.MapPath(strRequest)
'get file object as FileInfo
Dim file As System.IO.FileInfo = New System.IO.FileInfo(path)
'-- if the file exists on the server
If file.Exists Then
'set appropriate headers
Response.Clear()
Response.AddHeader("Content-Disposition", "attachment; filename=" & file.Name)
Response.AddHeader("Content-Length", file.Length.ToString())
Response.ContentType = "application/octet-stream"
Response.WriteFile(file.FullName)
Response.End
'if file does not exist
Else
Response.Write("This file does not exist.")
End If
'nothing in the URL as HTTP GET
Else
Response.Write("Please provide a file to download.")
End If
End Sub
</script>

y listo.. ya pueden descargar sus archivos...
saludos
y gracias a mi por la respuesta.....