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
|
Response.Clear()
Response.AddHeader("Content-Disposition", "attachment; filename=" + NomFichier)
Dim ext As String
Dim type As String
ext = NomFichier.Substring(NomFichier.LastIndexOf(".") + 1)
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 ".pdf"
type = "Application/pdf"
Case Else
type = "text/plain"
End Select
Response.ContentType = type
Response.Flush()
Response.TransmitFile(NomFichier)
Response.End() |
Partager