Ver Mensaje Individual
  #4 (permalink)  
Antiguo 17/05/2004, 08:55
Avatar de RootK
RootK
Moderador
 
Fecha de Ingreso: febrero-2002
Ubicación: México D.F
Mensajes: 8.004
Antigüedad: 22 años, 3 meses
Puntos: 50
Aprovechando éste post podría quedar de la siguiente forma.. podría aplicarse para una html, txt, word y/o excel creando una funcion:

Cita:
Private Sub DownloadFile(ByVal fname As String)
Dim path As Path

Dim fullpath = path.GetFullPath(fname)
Dim name = path.GetFileName(fullpath)
Dim ext = path.GetExtension(fullpath)
Dim type As String = ""

If Not IsDBNull(ext) Then
ext = LCase(ext)
End If

Select Case ext
Case ".htm", ".html"
type = "text/HTML"
Case ".txt"
type = "text/plain"
Case ".doc", ".rtf"
type = "Application/msword"
Case ".csv", ".xls"
type = "Application/x-msexcel"
Case Else
type = "text/plain"
End Select

Response.AppendHeader("content-disposition", _
"attachment; filename=" + name)

If type <> "" Then
Response.ContentType = type
End If

Response.WriteFile(fullpath)
Response.End()

End Sub
Y lo mandamos a llamar:

Cita:
DownloadFile("c:\archivo.doc")
Espero les sirva...
__________________
Nadie roba nada ya que en la vida todo se paga . . .

Exentrit - Soluciones SharePoint & Net