下載

下載

 

Dim fileinfo As New System.IO.FileInfo(pathAndFile)
            If fileinfo.Exists = True Then
            Response.ClearHeaders()
            Response.ClearContent()
            Response.Clear()
            Response.Expires = 0
            Response.Buffer = True
            pathAndFile = Right(pathAndFile, InStr(StrReverse(pathAndFile), "\") - 1)
    Response.AddHeader("Accept-Language", "zh-tw")
            Response.AddHeader("Content-Disposition", "attachment; filename=" & HttpUtility.UrlEncode(pathAndFile, System.Text.Encoding.UTF8))
            Response.AddHeader("Content-Length", fileinfo.Length.ToString())
            Response.ContentType = "text/xml"
            'Response.ContentType = "application/octet-stream"
    Response.WriteFile(fileinfo.FullName)
            Response.Flush()
            fileinfo.Delete()
        End If